home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2000 September / september_2000.iso / intercd / root / ^Linux / cfengine-1.5.3 / doc / locks.latex < prev    next >
LaTeX Document  |  1999-10-15  |  46.0 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: LaTeX Document (document/latex).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document text default
99% file LaTeX document, ASCII text, with CRLF line terminators default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: plain text[CRLF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 64 6f 63 75 6d 65 6e | 74 73 74 79 6c 65 5b 74 |\documen|tstyle[t|
|00000010| 77 6f 63 6f 6c 75 6d 6e | 5d 7b 61 72 74 69 63 6c |wocolumn|]{articl|
|00000020| 65 7d 0d 0a 0d 0a 5c 74 | 69 74 6c 65 7b 41 64 61 |e}....\t|itle{Ada|
|00000030| 70 74 69 76 65 20 6c 6f | 63 6b 73 20 66 6f 72 20 |ptive lo|cks for |
|00000040| 66 72 65 71 75 65 6e 74 | 6c 79 20 73 63 68 65 64 |frequent|ly sched|
|00000050| 75 6c 65 64 20 74 61 73 | 6b 73 20 77 69 74 68 5c |uled tas|ks with\|
|00000060| 5c 0d 0a 75 6e 70 72 65 | 64 69 63 74 61 62 6c 65 |\..unpre|dictable|
|00000070| 20 72 75 6e 74 69 6d 65 | 73 7d 0d 0a 0d 0a 5c 61 | runtime|s}....\a|
|00000080| 75 74 68 6f 72 7b 4d 61 | 72 6b 20 42 75 72 67 65 |uthor{Ma|rk Burge|
|00000090| 73 73 20 61 6e 64 20 44 | 65 6d 6f 73 74 68 65 6e |ss and D|emosthen|
|000000a0| 65 73 20 53 6b 69 70 69 | 74 61 72 69 73 5c 5c 7e |es Skipi|taris\\~|
|000000b0| 5c 5c 5c 65 6d 20 43 65 | 6e 74 72 65 20 6f 66 0d |\\\em Ce|ntre of.|
|000000c0| 0a 53 63 69 65 6e 63 65 | 20 61 6e 64 20 54 65 63 |.Science| and Tec|
|000000d0| 68 6e 6f 6c 6f 67 79 2c | 20 46 61 63 75 6c 74 79 |hnology,| Faculty|
|000000e0| 20 6f 66 20 45 6e 67 69 | 6e 65 65 72 69 6e 67 5c | of Engi|neering\|
|000000f0| 5c 5c 65 6d 20 4f 73 6c | 6f 20 43 6f 6c 6c 65 67 |\\em Osl|o Colleg|
|00000100| 65 2c 20 43 6f 72 74 0d | 0a 41 64 65 6c 65 72 73 |e, Cort.|.Adelers|
|00000110| 20 47 61 74 65 20 33 30 | 5c 5c 5c 65 6d 20 4e 2d | Gate 30|\\\em N-|
|00000120| 30 32 35 34 20 4f 73 6c | 6f 2c 20 4e 6f 72 77 61 |0254 Osl|o, Norwa|
|00000130| 79 7d 0d 0a 0d 0a 5c 62 | 65 67 69 6e 7b 64 6f 63 |y}....\b|egin{doc|
|00000140| 75 6d 65 6e 74 7d 0d 0a | 5c 6d 61 6b 65 74 69 74 |ument}..|\maketit|
|00000150| 6c 65 0d 0a 0d 0a 5c 62 | 65 67 69 6e 7b 61 62 73 |le....\b|egin{abs|
|00000160| 74 72 61 63 74 7d 0d 0a | 57 65 20 70 72 65 73 65 |tract}..|We prese|
|00000170| 6e 74 20 61 20 66 6f 72 | 6d 20 6f 66 20 64 69 73 |nt a for|m of dis|
|00000180| 63 72 65 74 69 6f 6e 61 | 72 79 20 6c 6f 63 6b 20 |cretiona|ry lock |
|00000190| 77 68 69 63 68 20 69 73 | 20 64 65 73 69 67 6e 65 |which is| designe|
|000001a0| 64 20 74 6f 20 72 65 6e | 64 65 72 0d 0a 75 6e 72 |d to ren|der..unr|
|000001b0| 65 6c 69 61 62 6c 65 20 | 62 75 74 20 66 72 65 71 |eliable |but freq|
|000001c0| 75 65 6e 74 6c 79 20 73 | 63 68 65 64 75 6c 65 64 |uently s|cheduled|
|000001d0| 20 73 63 72 69 70 74 73 | 20 6f 72 20 70 72 6f 67 | scripts| or prog|
|000001e0| 72 61 6d 73 20 70 72 65 | 64 69 63 74 61 62 6c 65 |rams pre|dictable|
|000001f0| 0d 0a 65 76 65 6e 20 77 | 68 65 6e 20 74 68 65 20 |..even w|hen the |
|00000200| 65 78 65 63 75 74 69 6f | 6e 20 74 69 6d 65 20 6f |executio|n time o|
|00000210| 66 20 6c 6f 63 6b 65 64 | 20 6f 70 65 72 61 74 69 |f locked| operati|
|00000220| 6f 6e 73 20 6d 61 79 20 | 67 72 6f 77 20 61 6e 64 |ons may |grow and|
|00000230| 20 65 78 63 65 65 64 0d | 0a 74 68 65 69 72 20 65 | exceed.|.their e|
|00000240| 78 70 65 63 74 65 64 20 | 73 63 68 65 64 75 6c 69 |xpected |scheduli|
|00000250| 6e 67 20 69 6e 74 65 72 | 76 61 6c 2e 20 57 65 20 |ng inter|val. We |
|00000260| 69 6d 70 6c 65 6d 65 6e | 74 20 6f 75 72 20 6c 6f |implemen|t our lo|
|00000270| 63 6b 69 6e 67 20 70 6f | 6c 69 63 79 0d 0a 77 69 |cking po|licy..wi|
|00000280| 74 68 20 6c 6f 63 6b 2d | 75 6e 6c 6f 63 6b 20 73 |th lock-|unlock s|
|00000290| 65 6d 61 6e 74 69 63 73 | 20 61 6e 64 20 74 65 73 |emantics| and tes|
|000002a0| 74 20 74 68 65 6d 20 6f | 6e 20 74 68 65 20 73 79 |t them o|n the sy|
|000002b0| 73 74 65 6d 20 61 64 6d | 69 6e 69 73 74 72 61 74 |stem adm|inistrat|
|000002c0| 69 6f 6e 0d 0a 6c 61 6e | 67 75 61 67 65 20 63 66 |ion..lan|guage cf|
|000002d0| 65 6e 67 69 6e 65 2e 20 | 54 68 65 20 6c 6f 63 6b |engine. |The lock|
|000002e0| 73 20 61 72 65 20 63 6f | 6e 74 72 6f 6c 6c 65 64 |s are co|ntrolled|
|000002f0| 20 62 79 20 74 6f 6f 2d | 73 6f 6f 6e 20 61 6e 64 | by too-|soon and|
|00000300| 20 74 6f 6f 2d 6c 61 74 | 65 0d 0a 70 61 72 61 6d | too-lat|e..param|
|00000310| 65 74 65 72 73 20 73 6f | 20 74 68 61 74 20 65 78 |eters so| that ex|
|00000320| 65 63 75 74 69 6f 6e 20 | 74 69 6d 65 73 20 63 61 |ecution |times ca|
|00000330| 6e 20 62 65 20 63 6f 6e | 74 72 6f 6c 6c 65 64 20 |n be con|trolled |
|00000340| 77 69 74 68 69 6e 20 66 | 69 78 65 64 0d 0a 62 6f |within f|ixed..bo|
|00000350| 75 6e 64 73 20 65 76 65 | 6e 20 77 68 65 6e 20 73 |unds eve|n when s|
|00000360| 63 68 65 64 75 6c 69 6e | 67 20 72 65 71 75 65 73 |chedulin|g reques|
|00000370| 74 73 20 6f 63 63 75 72 | 20 72 61 6e 64 6f 6d 6c |ts occur| randoml|
|00000380| 79 20 69 6e 20 61 64 64 | 69 74 69 6f 6e 20 74 6f |y in add|ition to|
|00000390| 20 74 68 65 0d 0a 70 65 | 72 69 6f 64 69 63 20 73 | the..pe|riodic s|
|000003a0| 63 68 65 64 75 6c 69 6e | 67 20 74 69 6d 65 2e 20 |chedulin|g time. |
|000003b0| 54 68 69 73 20 68 61 73 | 20 74 68 65 20 61 64 64 |This has| the add|
|000003c0| 65 64 20 62 6f 6e 75 73 | 20 6f 66 20 70 72 6f 76 |ed bonus| of prov|
|000003d0| 69 64 69 6e 67 20 61 6e | 0d 0a 61 6e 74 69 2d 73 |iding an|..anti-s|
|000003e0| 70 61 6d 6d 69 6e 67 20 | 66 75 6e 63 74 69 6f 6e |pamming |function|
|000003f0| 61 6c 69 74 79 2e 0d 0a | 0d 0a 5c 65 6e 64 7b 61 |ality...|..\end{a|
|00000400| 62 73 74 72 61 63 74 7d | 0d 0a 0d 0a 5c 73 65 63 |bstract}|....\sec|
|00000410| 74 69 6f 6e 7b 49 6e 74 | 72 6f 64 75 63 74 69 6f |tion{Int|roductio|
|00000420| 6e 7d 0d 0a 0d 0a 57 68 | 65 6e 20 74 77 6f 20 6f |n}....Wh|en two o|
|00000430| 72 20 6d 6f 72 65 20 69 | 6e 73 74 61 6e 74 69 61 |r more i|nstantia|
|00000440| 74 69 6f 6e 73 20 6f 66 | 20 61 20 70 72 6f 67 72 |tions of| a progr|
|00000450| 61 6d 20 75 73 65 20 61 | 20 72 65 73 6f 75 72 63 |am use a| resourc|
|00000460| 65 0d 0a 63 6f 6e 63 75 | 72 72 65 6e 74 6c 79 2c |e..concu|rrently,|
|00000470| 20 69 74 20 63 61 6e 20 | 6c 65 61 64 20 74 6f 20 | it can |lead to |
|00000480| 63 6f 6e 74 65 6e 74 69 | 6f 6e 20 62 65 74 77 65 |contenti|on betwe|
|00000490| 65 6e 20 74 68 65 20 63 | 6f 6d 70 65 74 69 6e 67 |en the c|ompeting|
|000004a0| 0d 0a 70 72 6f 63 65 73 | 73 65 73 20 61 6e 64 20 |..proces|ses and |
|000004b0| 75 6e 70 72 65 64 69 63 | 74 61 62 6c 65 20 72 65 |unpredic|table re|
|000004c0| 73 75 6c 74 73 2e 20 41 | 70 70 6c 69 63 61 74 69 |sults. A|pplicati|
|000004d0| 6f 6e 20 70 72 6f 67 72 | 61 6d 73 20 28 66 6f 72 |on progr|ams (for|
|000004e0| 0d 0a 65 78 61 6d 70 6c | 65 2c 20 6d 61 69 6c 2d |..exampl|e, mail-|
|000004f0| 72 65 61 64 65 72 73 20 | 6f 72 20 64 61 65 6d 6f |readers |or daemo|
|00000500| 6e 73 29 20 75 73 75 61 | 6c 6c 79 20 61 76 6f 69 |ns) usua|lly avoi|
|00000510| 64 20 74 68 69 73 20 73 | 69 74 75 61 74 69 6f 6e |d this s|ituation|
|00000520| 20 77 69 74 68 0d 0a 74 | 68 65 20 68 65 6c 70 20 | with..t|he help |
|00000530| 6f 66 20 61 20 6c 6f 63 | 6b 20 73 6f 20 74 68 61 |of a loc|k so tha|
|00000540| 74 20 6f 6e 6c 79 20 61 | 20 73 69 6e 67 6c 65 20 |t only a| single |
|00000550| 69 6e 73 74 61 6e 74 69 | 61 74 69 6f 6e 20 63 61 |instanti|ation ca|
|00000560| 6e 20 72 75 6e 20 61 74 | 20 61 0d 0a 67 69 76 65 |n run at| a..give|
|00000570| 6e 20 74 69 6d 65 2e 20 | 41 20 6c 6f 63 6b 20 69 |n time. |A lock i|
|00000580| 73 20 61 20 64 65 76 69 | 63 65 20 77 68 69 63 68 |s a devi|ce which|
|00000590| 20 61 73 73 75 72 65 73 | 20 74 68 61 74 20 6f 6e | assures| that on|
|000005a0| 6c 79 20 6f 6e 65 20 70 | 72 6f 63 65 73 73 20 63 |ly one p|rocess c|
|000005b0| 61 6e 0d 0a 75 73 65 20 | 61 20 73 70 65 63 69 66 |an..use |a specif|
|000005c0| 69 63 20 72 65 73 6f 75 | 72 63 65 20 61 74 20 61 |ic resou|rce at a|
|000005d0| 20 67 69 76 65 6e 20 74 | 69 6d 65 5c 63 69 74 65 | given t|ime\cite|
|000005e0| 7b 6c 6f 63 6b 64 65 66 | 2c 6c 6f 63 6b 64 65 66 |{lockdef|,lockdef|
|000005f0| 32 7d 3b 20 61 6e 0d 0a | 61 70 70 6c 69 63 61 74 |2}; an..|applicat|
|00000600| 69 6f 6e 20 6c 6f 63 6b | 20 6d 61 6b 65 73 20 74 |ion lock| makes t|
|00000610| 68 65 20 65 78 65 63 75 | 74 69 6f 6e 20 6f 66 20 |he execu|tion of |
|00000620| 61 6e 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 70 |an appli|cation p|
|00000630| 72 6f 67 72 61 6d 20 69 | 6e 74 6f 20 61 6e 0d 0a |rogram i|nto an..|
|00000640| 65 78 63 6c 75 73 69 76 | 65 20 72 65 73 6f 75 72 |exclusiv|e resour|
|00000650| 63 65 2e 20 41 20 74 79 | 70 69 63 61 6c 20 61 70 |ce. A ty|pical ap|
|00000660| 70 72 6f 61 63 68 20 74 | 6f 20 6c 6f 63 6b 69 6e |proach t|o lockin|
|00000670| 67 20 69 73 20 74 6f 20 | 77 72 69 74 65 20 61 20 |g is to |write a |
|00000680| 73 68 6f 72 74 0d 0a 66 | 69 6c 65 20 77 68 69 63 |short..f|ile whic|
|00000690| 68 20 63 6f 6e 74 61 69 | 6e 73 20 74 68 65 20 70 |h contai|ns the p|
|000006a0| 72 6f 63 65 73 73 20 49 | 44 20 6f 66 20 74 68 65 |rocess I|D of the|
|000006b0| 20 72 75 6e 6e 69 6e 67 | 0d 0a 61 70 70 6c 69 63 | running|..applic|
|000006c0| 61 74 69 6f 6e 5c 63 69 | 74 65 7b 61 70 70 6c 6f |ation\ci|te{applo|
|000006d0| 63 6b 7d 2e 20 20 54 68 | 65 20 66 69 6c 65 20 68 |ck}. Th|e file h|
|000006e0| 61 73 20 61 20 75 6e 69 | 71 75 65 20 6e 61 6d 65 |as a uni|que name|
|000006f0| 20 61 6e 64 20 69 73 0d | 0a 74 68 65 72 65 66 6f | and is.|.therefo|
|00000700| 72 65 20 74 72 69 76 69 | 61 6c 6c 79 2d 6c 6f 63 |re trivi|ally-loc|
|00000710| 61 74 61 62 6c 65 20 62 | 79 20 6d 75 6c 74 69 70 |atable b|y multip|
|00000720| 6c 65 20 69 6e 73 74 61 | 6e 74 69 61 74 69 6f 6e |le insta|ntiation|
|00000730| 73 20 6f 66 20 74 68 65 | 0d 0a 70 72 6f 67 72 61 |s of the|..progra|
|00000740| 6d 2e 20 20 41 6e 20 61 | 70 70 6c 69 63 61 74 69 |m. An a|pplicati|
|00000750| 6f 6e 20 6c 6f 63 6b 20 | 69 73 20 67 65 6e 65 72 |on lock |is gener|
|00000760| 61 6c 6c 79 20 61 64 65 | 71 75 61 74 65 20 66 6f |ally ade|quate fo|
|00000770| 72 20 70 72 6f 67 72 61 | 6d 73 20 77 68 69 63 68 |r progra|ms which|
|00000780| 0d 0a 73 74 61 72 74 20 | 61 6e 64 20 74 68 65 6e |..start |and then|
|00000790| 20 65 78 70 65 63 74 20 | 74 6f 20 63 6f 6e 74 69 | expect |to conti|
|000007a0| 6e 75 65 20 6d 6f 72 65 | 20 6f 72 20 6c 65 73 73 |nue more| or less|
|000007b0| 20 69 6e 64 65 66 69 6e | 69 74 65 6c 79 2c 20 65 | indefin|itely, e|
|000007c0| 2e 67 2e 5c 0d 0a 64 61 | 65 6d 6f 6e 73 20 73 75 |.g.\..da|emons su|
|000007d0| 63 68 20 61 73 20 7b 5c | 74 74 20 63 72 6f 6e 7d |ch as {\|tt cron}|
|000007e0| 20 61 6e 64 20 6d 61 69 | 6c 20 72 65 61 64 65 72 | and mai|l reader|
|000007f0| 73 2c 20 62 75 74 20 69 | 74 20 63 61 6e 20 6c 65 |s, but i|t can le|
|00000800| 61 64 20 74 6f 0d 0a 75 | 6e 66 6f 72 74 75 6e 61 |ad to..u|nfortuna|
|00000810| 74 65 20 70 72 6f 62 6c | 65 6d 73 20 69 66 20 75 |te probl|ems if u|
|00000820| 73 65 64 20 74 6f 20 62 | 6c 6f 63 6b 20 66 72 65 |sed to b|lock fre|
|00000830| 71 75 65 6e 74 6c 79 20 | 6f 72 20 70 65 72 69 6f |quently |or perio|
|00000840| 64 69 63 61 6c 6c 79 20 | 72 75 6e 0d 0a 70 72 6f |dically |run..pro|
|00000850| 67 72 61 6d 73 20 6f 72 | 20 73 63 72 69 70 74 73 |grams or| scripts|
|00000860| 2e 20 49 66 20 74 68 65 | 20 64 75 72 61 74 69 6f |. If the| duratio|
|00000870| 6e 20 6f 66 20 73 75 63 | 68 20 61 20 70 72 6f 67 |n of suc|h a prog|
|00000880| 72 61 6d 20 69 73 20 63 | 61 70 61 62 6c 65 20 6f |ram is c|apable o|
|00000890| 66 0d 0a 65 78 63 65 65 | 64 69 6e 67 20 69 74 73 |f..excee|ding its|
|000008a0| 20 73 63 68 65 64 75 6c | 69 6e 67 20 69 6e 74 65 | schedul|ing inte|
|000008b0| 72 76 61 6c 2c 20 74 68 | 65 6e 20 74 68 65 72 65 |rval, th|en there|
|000008c0| 20 63 6f 75 6c 64 20 62 | 65 20 61 6e 20 6f 76 65 | could b|e an ove|
|000008d0| 72 6c 61 70 0d 0a 62 65 | 74 77 65 65 6e 20 69 6e |rlap..be|tween in|
|000008e0| 73 74 61 6e 74 69 61 74 | 69 6f 6e 73 20 6f 66 20 |stantiat|ions of |
|000008f0| 74 68 65 20 70 72 6f 67 | 72 61 6d 20 6f 72 20 61 |the prog|ram or a|
|00000900| 20 66 61 69 6c 75 72 65 | 20 6f 66 20 74 68 65 20 | failure| of the |
|00000910| 70 72 6f 67 72 61 6d 20 | 74 6f 0d 0a 62 65 20 73 |program |to..be s|
|00000920| 74 61 72 74 65 64 20 61 | 74 20 74 68 65 20 63 6f |tarted a|t the co|
|00000930| 72 72 65 63 74 20 74 69 | 6d 65 2c 20 61 6e 64 20 |rrect ti|me, and |
|00000940| 74 68 69 73 20 6d 75 73 | 74 20 62 65 20 64 65 61 |this mus|t be dea|
|00000950| 6c 74 20 77 69 74 68 20 | 69 6e 20 61 0d 0a 73 65 |lt with |in a..se|
|00000960| 6e 73 69 62 6c 65 20 77 | 61 79 2e 20 20 54 68 69 |nsible w|ay. Thi|
|00000970| 73 20 70 72 6f 62 6c 65 | 6d 20 69 73 20 6f 66 20 |s proble|m is of |
|00000980| 70 61 72 74 69 63 75 6c | 61 72 20 69 6e 74 65 72 |particul|ar inter|
|00000990| 65 73 74 20 69 6e 20 63 | 6f 6e 6e 65 63 74 69 6f |est in c|onnectio|
|000009a0| 6e 0d 0a 77 69 74 68 20 | 61 75 74 6f 6d 61 74 65 |n..with |automate|
|000009b0| 64 20 73 79 73 74 65 6d | 20 61 64 6d 69 6e 69 73 |d system| adminis|
|000009c0| 74 72 61 74 69 6f 6e 20 | 77 68 65 72 65 20 63 6f |tration |where co|
|000009d0| 6d 70 6c 65 78 20 73 63 | 72 69 70 74 73 20 61 72 |mplex sc|ripts ar|
|000009e0| 65 20 6f 66 74 65 6e 0d | 0a 73 63 68 65 64 75 6c |e often.|.schedul|
|000009f0| 65 64 20 62 79 20 63 72 | 6f 6e 2c 20 62 75 74 20 |ed by cr|on, but |
|00000a00| 6d 61 79 20 61 6c 73 6f | 20 62 65 20 73 74 61 72 |may also| be star|
|00000a10| 74 65 64 20 62 79 20 68 | 61 6e 64 2e 0d 0a 0d 0a |ted by h|and.....|
|00000a20| 4c 65 74 20 75 73 20 67 | 69 76 65 20 61 20 63 6f |Let us g|ive a co|
|00000a30| 6e 63 72 65 74 65 20 65 | 78 61 6d 70 6c 65 2e 20 |ncrete e|xample. |
|00000a40| 43 6f 6e 73 69 64 65 72 | 20 61 20 70 72 6f 67 72 |Consider| a progr|
|00000a50| 61 6d 2c 20 72 75 6e 20 | 68 6f 75 72 6c 79 20 62 |am, run |hourly b|
|00000a60| 79 0d 0a 63 72 6f 6e 2c | 20 77 68 69 63 68 20 65 |y..cron,| which e|
|00000a70| 78 65 63 75 74 65 73 20 | 61 20 72 65 6d 6f 74 65 |xecutes |a remote|
|00000a80| 20 63 6f 6d 6d 61 6e 64 | 20 6f 6e 20 61 20 73 65 | command| on a se|
|00000a90| 72 69 65 73 20 6f 66 20 | 68 6f 73 74 73 3b 20 6f |ries of |hosts; o|
|00000aa0| 6e 65 20 63 61 6e 0d 0a | 69 6d 61 67 69 6e 65 20 |ne can..|imagine |
|00000ab0| 61 20 70 72 6f 67 72 61 | 6d 20 77 68 69 63 68 20 |a progra|m which |
|00000ac0| 64 69 73 74 72 69 62 75 | 74 65 73 20 6f 72 20 6d |distribu|tes or m|
|00000ad0| 61 6b 65 73 20 63 6f 70 | 69 65 73 20 6f 66 20 6b |akes cop|ies of k|
|00000ae0| 65 79 20 66 69 6c 65 73 | 2e 20 54 68 65 0d 0a 74 |ey files|. The..t|
|00000af0| 69 6d 65 20 66 6f 72 20 | 74 68 69 73 20 6a 6f 62 |ime for |this job|
|00000b00| 20 74 6f 20 63 6f 6d 70 | 6c 65 74 65 20 64 65 70 | to comp|lete dep|
|00000b10| 65 6e 64 73 20 6f 6e 20 | 6d 61 6e 79 20 66 61 63 |ends on |many fac|
|00000b20| 74 6f 72 73 3a 20 74 68 | 65 20 73 69 7a 65 20 6f |tors: th|e size o|
|00000b30| 66 20 74 68 65 0d 0a 66 | 69 6c 65 73 2c 20 74 68 |f the..f|iles, th|
|00000b40| 65 20 73 70 65 65 64 20 | 6f 66 20 74 68 65 20 6e |e speed |of the n|
|00000b50| 65 74 77 6f 72 6b 2c 20 | 74 68 65 20 6c 6f 61 64 |etwork, |the load|
|00000b60| 20 6f 6e 20 74 68 65 20 | 70 61 72 74 69 63 69 70 | on the |particip|
|00000b70| 61 74 69 6e 67 20 68 6f | 73 74 73 0d 0a 65 74 63 |ating ho|sts..etc|
|00000b80| 2e 20 49 66 20 74 68 65 | 20 6e 65 74 77 6f 72 6b |. If the| network|
|00000b90| 20 6c 61 74 65 6e 63 79 | 20 74 69 6d 65 20 77 65 | latency| time we|
|00000ba0| 72 65 20 68 69 67 68 2c | 20 6f 72 20 69 66 20 61 |re high,| or if a|
|00000bb0| 6e 20 52 50 43 20 65 72 | 72 6f 72 0d 0a 6f 63 63 |n RPC er|ror..occ|
|00000bc0| 75 72 72 65 64 20 74 68 | 65 6e 20 74 68 69 73 20 |urred th|en this |
|00000bd0| 73 63 72 69 70 74 20 6f | 72 20 70 72 6f 67 72 61 |script o|r progra|
|00000be0| 6d 20 63 6f 75 6c 64 20 | 68 61 6e 67 20 63 6f 6d |m could |hang com|
|00000bf0| 70 6c 65 74 65 6c 79 20 | 6f 72 20 66 61 69 6c 20 |pletely |or fail |
|00000c00| 74 6f 0d 0a 63 6f 6d 70 | 6c 65 74 65 20 69 6e 73 |to..comp|lete ins|
|00000c10| 69 64 65 20 69 74 73 20 | 61 6c 6c 6f 74 74 65 64 |ide its |allotted|
|00000c20| 20 68 6f 75 72 2e 20 41 | 66 74 65 72 20 74 68 65 | hour. A|fter the|
|00000c30| 20 6e 65 78 74 20 65 6c | 61 70 73 65 64 20 68 6f | next el|apsed ho|
|00000c40| 75 72 2c 20 74 68 65 0d | 0a 68 61 6e 67 69 6e 67 |ur, the.|.hanging|
|00000c50| 20 6c 6f 63 6b 20 77 6f | 75 6c 64 20 72 65 73 75 | lock wo|uld resu|
|00000c60| 6c 74 20 69 6e 20 61 6e | 20 61 6e 6e 6f 79 69 6e |lt in an| annoyin|
|00000c70| 67 20 65 72 72 6f 72 20 | 61 6e 64 20 61 20 66 61 |g error |and a fa|
|00000c80| 69 6c 75 72 65 20 6f 66 | 20 74 68 65 0d 0a 70 72 |ilure of| the..pr|
|00000c90| 6f 67 72 61 6d 20 74 6f | 20 70 65 72 66 6f 72 6d |ogram to| perform|
|00000ca0| 20 69 74 73 20 74 61 73 | 6b 2e 20 49 66 20 6c 65 | its tas|k. If le|
|00000cb0| 66 74 20 75 6e 6c 6f 63 | 6b 65 64 2c 20 74 68 65 |ft unloc|ked, the|
|00000cc0| 72 65 20 63 6f 75 6c 64 | 20 62 65 0d 0a 63 6f 6e |re could| be..con|
|00000cd0| 74 65 6e 74 69 6f 6e 20 | 62 65 74 77 65 65 6e 20 |tention |between |
|00000ce0| 6d 75 6c 74 69 70 6c 65 | 20 69 6e 73 74 61 6e 74 |multiple| instant|
|00000cf0| 69 61 74 69 6f 6e 73 20 | 6f 66 20 74 68 65 20 70 |iations |of the p|
|00000d00| 72 6f 67 72 61 6d 20 61 | 6e 64 0d 0a 69 6e 63 6f |rogram a|nd..inco|
|00000d10| 6e 73 69 73 74 65 6e 74 | 20 72 65 73 75 6c 74 73 |nsistent| results|
|00000d20| 2e 0d 0a 0d 0a 4e 65 74 | 77 6f 72 6b 20 73 65 72 |.....Net|work ser|
|00000d30| 76 69 63 65 73 20 70 72 | 65 73 65 6e 74 20 61 20 |vices pr|esent a |
|00000d40| 72 65 6c 61 74 65 64 20 | 70 72 6f 62 6c 65 6d 2e |related |problem.|
|00000d50| 20 43 6f 6e 73 69 64 65 | 72 20 61 20 70 72 6f 67 | Conside|r a prog|
|00000d60| 72 61 6d 20 77 68 69 63 | 68 0d 0a 69 73 20 69 6e |ram whic|h..is in|
|00000d70| 69 74 69 61 74 65 64 20 | 62 79 20 61 20 6e 65 74 |itiated |by a net|
|00000d80| 77 6f 72 6b 20 63 6f 6e | 6e 65 63 74 69 6f 6e 20 |work con|nection |
|00000d90| 74 6f 20 61 20 70 61 72 | 74 69 63 75 6c 61 72 20 |to a par|ticular |
|00000da0| 70 6f 72 74 20 66 6f 72 | 20 74 68 65 0d 0a 70 75 |port for| the..pu|
|00000db0| 72 70 6f 73 65 73 20 6f | 66 20 75 70 64 61 74 69 |rposes o|f updati|
|00000dc0| 6e 67 20 6f 6e 65 20 6f | 72 20 6d 6f 72 65 20 72 |ng one o|r more r|
|00000dd0| 65 73 6f 75 72 63 65 73 | 2e 20 49 74 20 69 73 20 |esources|. It is |
|00000de0| 64 65 73 69 72 61 62 6c | 65 20 74 6f 20 6c 6f 63 |desirabl|e to loc|
|00000df0| 6b 0d 0a 73 75 63 68 20 | 61 20 70 72 6f 67 72 61 |k..such |a progra|
|00000e00| 6d 20 74 6f 20 61 76 6f | 69 64 20 63 6f 6e 74 65 |m to avo|id conte|
|00000e10| 6e 74 69 6f 6e 20 62 65 | 74 77 65 65 6e 20 6d 75 |ntion be|tween mu|
|00000e20| 6c 74 69 70 6c 65 20 63 | 6f 6e 6e 65 63 74 69 6f |ltiple c|onnectio|
|00000e30| 6e 73 2e 20 49 74 0d 0a | 6d 69 67 68 74 20 62 65 |ns. It..|might be|
|00000e40| 20 61 70 70 72 6f 70 72 | 69 61 74 65 20 74 6f 20 | appropr|iate to |
|00000e50| 6c 6f 63 6b 20 74 68 65 | 20 65 6e 74 69 72 65 20 |lock the| entire |
|00000e60| 70 72 6f 63 65 73 73 20 | 77 69 74 68 20 61 20 73 |process |with a s|
|00000e70| 69 6e 67 6c 65 20 74 68 | 72 65 61 64 65 64 0d 0a |ingle th|readed..|
|00000e80| 63 6f 6e 6e 65 63 74 69 | 6f 6e 2e 20 53 65 72 76 |connecti|on. Serv|
|00000e90| 69 63 65 20 64 65 6d 75 | 6c 74 69 70 6c 65 78 65 |ice demu|ltiplexe|
|00000ea0| 72 73 20 6c 69 6b 65 20 | 7b 5c 74 74 20 69 6e 65 |rs like |{\tt ine|
|00000eb0| 74 64 7d 20 63 6f 6e 74 | 61 69 6e 20 74 68 65 0d |td} cont|ain the.|
|00000ec0| 0a 66 75 6e 63 74 69 6f | 6e 61 6c 69 74 79 20 72 |.functio|nality r|
|00000ed0| 65 71 75 69 72 65 64 20 | 74 6f 20 73 65 72 69 61 |equired |to seria|
|00000ee0| 6c 69 7a 65 20 61 63 63 | 65 73 73 2e 20 20 4f 6e |lize acc|ess. On|
|00000ef0| 20 74 68 65 20 6f 74 68 | 65 72 20 68 61 6e 64 2c | the oth|er hand,|
|00000f00| 20 69 74 0d 0a 6d 69 67 | 68 74 20 62 65 20 62 65 | it..mig|ht be be|
|00000f10| 74 74 65 72 20 74 6f 20 | 6c 6f 63 6b 20 6f 6e 6c |tter to |lock onl|
|00000f20| 79 20 73 70 65 63 69 66 | 69 63 20 72 65 73 6f 75 |y specif|ic resou|
|00000f30| 72 63 65 73 2e 20 20 57 | 65 20 6d 69 67 68 74 20 |rces. W|e might |
|00000f40| 77 69 73 68 20 74 6f 20 | 67 6f 0d 0a 65 76 65 6e |wish to |go..even|
|00000f50| 20 66 75 72 74 68 65 72 | 20 61 6e 64 20 72 65 73 | further| and res|
|00000f60| 74 72 69 63 74 20 74 68 | 65 20 66 72 65 71 75 65 |trict th|e freque|
|00000f70| 6e 63 79 20 61 74 20 77 | 68 69 63 68 20 74 68 65 |ncy at w|hich the|
|00000f80| 20 70 72 6f 67 72 61 6d | 20 63 61 6e 20 62 65 0d | program| can be.|
|00000f90| 0a 72 75 6e 20 61 74 20 | 61 6c 6c 2e 20 53 75 63 |.run at |all. Suc|
|00000fa0| 68 20 61 20 63 6f 6e 74 | 69 6e 67 65 6e 63 79 20 |h a cont|ingency |
|00000fb0| 63 6f 75 6c 64 20 62 65 | 20 75 73 65 64 20 74 6f |could be| used to|
|00000fc0| 20 70 72 65 76 65 6e 74 | 20 73 70 61 6d 6d 69 6e | prevent| spammin|
|00000fd0| 67 20 6f 66 0d 0a 74 68 | 65 20 6e 65 74 77 6f 72 |g of..th|e networ|
|00000fe0| 6b 20 63 6f 6e 6e 65 63 | 74 69 6f 6e 20 6f 72 20 |k connec|tion or |
|00000ff0| 65 76 65 6e 20 74 68 65 | 20 61 63 63 69 64 65 6e |even the| acciden|
|00001000| 74 61 6c 20 77 61 73 74 | 61 67 65 20 6f 66 20 43 |tal wast|age of C|
|00001010| 50 55 20 74 69 6d 65 2e | 0d 0a 41 6c 6c 20 6f 66 |PU time.|..All of|
|00001020| 20 74 68 65 20 61 62 6f | 76 65 20 65 78 61 6d 70 | the abo|ve examp|
|00001030| 6c 65 73 20 6d 61 79 20 | 62 65 20 74 68 6f 75 67 |les may |be thoug|
|00001040| 68 74 20 6f 66 20 69 6e | 20 74 65 72 6d 73 20 6f |ht of in| terms o|
|00001050| 66 20 72 65 73 6f 75 72 | 63 65 0d 0a 73 68 61 72 |f resour|ce..shar|
|00001060| 69 6e 67 20 69 6e 20 61 | 20 63 6f 6e 63 75 72 72 |ing in a| concurr|
|00001070| 65 6e 74 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 2e |ent envi|ronment.|
|00001080| 0d 0a 0d 0a 49 66 20 77 | 65 20 66 6f 63 75 73 20 |....If w|e focus |
|00001090| 6f 75 72 20 61 74 74 65 | 6e 74 69 6f 6e 20 6d 6f |our atte|ntion mo|
|000010a0| 72 65 20 74 6f 20 74 68 | 65 20 70 72 6f 62 6c 65 |re to th|e proble|
|000010b0| 6d 20 6f 66 20 72 65 73 | 6f 75 72 63 65 20 63 6f |m of res|ource co|
|000010c0| 6e 74 72 6f 6c 20 77 65 | 0d 0a 67 61 69 6e 20 61 |ntrol we|..gain a|
|000010d0| 20 6e 65 77 20 70 65 72 | 73 70 65 63 74 69 76 65 | new per|spective|
|000010e0| 20 6f 6e 20 74 68 65 20 | 70 72 6f 62 6c 65 6d 20 | on the |problem |
|000010f0| 6f 66 20 6d 75 6c 74 69 | 70 6c 65 20 70 72 6f 67 |of multi|ple prog|
|00001100| 72 61 6d 0d 0a 69 6e 73 | 74 61 6e 74 69 61 74 69 |ram..ins|tantiati|
|00001110| 6f 6e 73 2e 20 20 52 61 | 74 68 65 72 20 74 68 61 |ons. Ra|ther tha|
|00001120| 6e 20 6c 6f 63 6b 69 6e | 67 20 61 6e 20 65 6e 74 |n lockin|g an ent|
|00001130| 69 72 65 20 70 72 6f 67 | 72 61 6d 2c 20 77 65 20 |ire prog|ram, we |
|00001140| 6c 6f 63 6b 0d 0a 73 6d | 61 6c 6c 65 72 20 70 61 |lock..sm|aller pa|
|00001150| 72 74 73 20 77 68 69 63 | 68 20 61 72 65 20 69 6e |rts whic|h are in|
|00001160| 64 65 70 65 6e 64 65 6e | 74 2e 20 20 54 68 65 20 |dependen|t. The |
|00001170| 69 64 65 61 20 68 65 72 | 65 20 69 73 20 74 68 61 |idea her|e is tha|
|00001180| 74 20 69 74 20 69 73 0d | 0a 75 73 65 66 75 6c 20 |t it is.|.useful |
|00001190| 74 6f 20 75 73 65 20 64 | 69 73 63 72 65 74 69 6f |to use d|iscretio|
|000011a0| 6e 61 72 79 20 6c 6f 63 | 6b 73 20 74 6f 20 63 6f |nary loc|ks to co|
|000011b0| 6e 74 72 6f 6c 20 6f 6e | 6c 79 20 73 70 65 63 69 |ntrol on|ly speci|
|000011c0| 66 69 63 20 72 65 73 6f | 75 72 63 65 73 0d 0a 72 |fic reso|urces..r|
|000011d0| 65 71 75 69 72 65 64 20 | 77 69 74 68 69 6e 20 61 |equired |within a|
|000011e0| 20 70 72 6f 67 72 61 6d | 5c 63 69 74 65 7b 74 61 | program|\cite{ta|
|000011f0| 6e 65 6e 62 61 75 6d 31 | 2c 74 72 61 6e 73 61 63 |nenbaum1|,transac|
|00001200| 74 69 6f 6e 73 7d 2e 20 | 20 53 75 63 68 20 60 6c |tions}. | Such `l|
|00001210| 6f 63 61 6c 27 0d 0a 6c | 6f 63 6b 73 20 6d 69 67 |ocal'..l|ocks mig|
|00001220| 68 74 20 61 6c 6c 6f 77 | 20 61 20 70 72 6f 67 72 |ht allow| a progr|
|00001230| 61 6d 20 74 6f 20 72 75 | 6e 20 70 61 72 74 69 61 |am to ru|n partia|
|00001240| 6c 6c 79 2c 20 62 6c 6f | 63 6b 69 6e 67 20 63 6f |lly, blo|cking co|
|00001250| 6c 6c 69 73 69 6f 6e 73 | 2c 20 62 75 74 0d 0a 77 |llisions|, but..w|
|00001260| 6f 75 6c 64 20 61 64 6d | 69 74 20 61 63 63 65 73 |ould adm|it acces|
|00001270| 73 20 74 6f 20 74 68 65 | 20 62 75 73 79 20 72 65 |s to the| busy re|
|00001280| 73 6f 75 72 63 65 73 20 | 6f 6e 20 61 20 6f 6e 65 |sources |on a one|
|00001290| 2d 62 79 2d 6f 6e 65 20 | 62 61 73 69 73 2e 20 54 |-by-one |basis. T|
|000012a0| 68 69 73 0d 0a 6d 69 67 | 68 74 20 6e 6f 74 20 61 |his..mig|ht not a|
|000012b0| 6c 77 61 79 73 20 62 65 | 20 64 65 73 69 72 61 62 |lways be| desirab|
|000012c0| 6c 65 20 74 68 6f 75 67 | 68 3a 20 74 68 65 20 73 |le thoug|h: the s|
|000012d0| 63 68 65 6d 65 20 63 6f | 75 6c 64 20 72 65 73 75 |cheme co|uld resu|
|000012e0| 6c 74 20 69 6e 0d 0a 61 | 77 6b 77 61 72 64 20 70 |lt in..a|wkward p|
|000012f0| 72 6f 62 6c 65 6d 73 20 | 69 66 20 74 68 65 20 72 |roblems |if the r|
|00001300| 65 73 6f 75 72 63 65 73 | 20 77 65 72 65 20 63 72 |esources| were cr|
|00001310| 69 74 69 63 61 6c 20 74 | 6f 20 74 68 65 20 6f 70 |itical t|o the op|
|00001320| 65 72 61 74 69 6f 6e 20 | 6f 66 0d 0a 74 68 65 20 |eration |of..the |
|00001330| 70 72 6f 67 72 61 6d 20 | 61 73 20 61 20 77 68 6f |program |as a who|
|00001340| 6c 65 2e 20 20 54 68 65 | 20 70 72 6f 67 72 61 6d |le. The| program|
|00001350| 20 6d 69 67 68 74 20 62 | 65 20 66 6f 72 63 65 64 | might b|e forced|
|00001360| 20 74 6f 20 65 78 69 74 | 20 77 69 74 68 6f 75 74 | to exit| without|
|00001370| 0d 0a 70 65 72 66 6f 72 | 6d 69 6e 67 20 69 74 73 |..perfor|ming its|
|00001380| 20 66 75 6e 63 74 69 6f | 6e 20 61 74 20 61 6c 6c | functio|n at all|
|00001390| 20 61 6e 64 20 74 68 75 | 73 20 74 69 6d 65 20 73 | and thu|s time s|
|000013a0| 70 65 6e 74 20 65 78 65 | 63 75 74 69 6e 67 20 74 |pent exe|cuting t|
|000013b0| 68 65 0d 0a 70 61 72 74 | 69 61 6c 2d 70 72 6f 67 |he..part|ial-prog|
|000013c0| 72 61 6d 20 77 6f 75 6c | 64 20 6f 6e 6c 79 20 62 |ram woul|d only b|
|000013d0| 65 20 43 50 55 20 74 69 | 6d 65 20 77 61 73 74 65 |e CPU ti|me waste|
|000013e0| 64 2e 20 20 55 6e 6c 69 | 6b 65 20 6c 6f 63 6b 69 |d. Unli|ke locki|
|000013f0| 6e 67 20 6f 66 0d 0a 6b | 65 72 6e 65 6c 20 72 65 |ng of..k|ernel re|
|00001400| 73 6f 75 72 63 65 73 2c | 20 6f 72 20 64 61 74 61 |sources,| or data|
|00001410| 62 61 73 65 20 6f 70 65 | 72 61 74 69 6f 6e 73 2c |base ope|rations,|
|00001420| 20 74 68 65 20 63 6f 2d | 65 78 69 73 74 65 6e 63 | the co-|existenc|
|00001430| 65 20 6f 66 20 6d 75 6c | 74 69 70 6c 65 0d 0a 70 |e of mul|tiple..p|
|00001440| 72 6f 67 72 61 6d 73 20 | 64 6f 65 73 20 6e 6f 74 |rograms |does not|
|00001450| 20 6e 65 63 65 73 73 61 | 72 69 6c 79 20 72 65 71 | necessa|rily req|
|00001460| 75 69 72 65 20 75 73 20 | 74 6f 20 70 72 65 73 65 |uire us |to prese|
|00001470| 72 76 65 20 65 76 65 72 | 79 20 6f 70 65 72 61 74 |rve ever|y operat|
|00001480| 69 6f 6e 0d 0a 61 6e 64 | 20 73 65 72 69 61 6c 69 |ion..and| seriali|
|00001490| 7a 65 20 74 68 65 6d 2c | 20 69 74 20 69 73 20 73 |ze them,| it is s|
|000014a0| 6f 6d 65 74 69 6d 65 73 | 20 73 75 66 66 69 63 69 |ometimes| suffici|
|000014b0| 65 6e 74 20 74 6f 20 65 | 6e 73 75 72 65 20 74 68 |ent to e|nsure th|
|000014c0| 61 74 20 6f 6e 6c 79 20 | 74 68 65 0d 0a 6d 6f 73 |at only |the..mos|
|000014d0| 74 20 75 70 2d 74 6f 2d | 64 61 74 65 20 69 6e 73 |t up-to-|date ins|
|000014e0| 74 61 6e 74 69 61 74 69 | 6f 6e 20 69 73 20 61 6c |tantiati|on is al|
|000014f0| 6c 6f 77 65 64 20 74 6f | 20 72 75 6e 20 61 74 20 |lowed to| run at |
|00001500| 61 20 67 69 76 65 6e 20 | 74 69 6d 65 2e 20 49 74 |a given |time. It|
|00001510| 0d 0a 63 6f 75 6c 64 20 | 61 6c 73 6f 20 62 65 20 |..could |also be |
|00001520| 61 63 63 65 70 74 61 62 | 6c 65 20 74 6f 20 68 61 |acceptab|le to ha|
|00001530| 76 65 20 64 69 66 66 65 | 72 65 6e 74 20 69 6e 73 |ve diffe|rent ins|
|00001540| 74 61 6e 74 69 61 74 69 | 6f 6e 73 20 6f 66 20 61 |tantiati|ons of a|
|00001550| 20 70 72 6f 67 72 61 6d | 0d 0a 72 75 6e 6e 69 6e | program|..runnin|
|00001560| 67 20 63 6f 6e 63 75 72 | 72 65 6e 74 6c 79 2c 20 |g concur|rently, |
|00001570| 62 75 74 20 69 6e 20 73 | 75 63 68 20 61 20 77 61 |but in s|uch a wa|
|00001580| 79 20 74 68 61 74 20 74 | 68 65 79 20 64 69 64 20 |y that t|hey did |
|00001590| 6e 6f 74 20 69 6e 74 65 | 72 66 65 72 65 2e 0d 0a |not inte|rfere...|
|000015a0| 0d 0a 49 6e 20 73 70 69 | 74 65 20 6f 66 20 61 6c |..In spi|te of al|
|000015b0| 6c 20 74 68 65 20 63 6f | 6e 64 69 74 69 6f 6e 61 |l the co|nditiona|
|000015c0| 6c 73 20 69 6e 20 74 68 | 65 20 61 62 6f 76 65 2c |ls in th|e above,|
|000015d0| 20 69 74 20 69 73 20 70 | 6f 73 73 69 62 6c 65 20 | it is p|ossible |
|000015e0| 74 6f 0d 0a 61 64 64 72 | 65 73 73 20 61 20 6c 61 |to..addr|ess a la|
|000015f0| 72 67 65 20 70 72 6f 70 | 6f 72 74 69 6f 6e 20 6f |rge prop|ortion o|
|00001600| 66 20 74 68 65 20 63 61 | 73 65 73 20 65 6e 63 6f |f the ca|ses enco|
|00001610| 75 6e 74 65 72 65 64 20 | 62 79 20 73 79 73 74 65 |untered |by syste|
|00001620| 6d 0d 0a 74 61 73 6b 73 | 2e 20 49 6e 20 74 68 69 |m..tasks|. In thi|
|00001630| 73 20 70 61 70 65 72 20 | 77 65 20 61 72 65 20 69 |s paper |we are i|
|00001640| 6e 74 65 72 65 73 74 65 | 64 20 69 6e 20 74 68 65 |ntereste|d in the|
|00001650| 20 66 69 72 73 74 20 63 | 61 73 65 20 77 68 65 72 | first c|ase wher|
|00001660| 65 20 69 74 20 69 73 0d | 0a 6d 65 61 6e 69 6e 67 |e it is.|.meaning|
|00001670| 66 75 6c 20 74 6f 20 6c | 6f 63 6b 20 73 65 6c 66 |ful to l|ock self|
|00001680| 2d 63 6f 6e 74 61 69 6e | 65 64 20 60 6f 62 6a 65 |-contain|ed `obje|
|00001690| 63 74 73 27 20 77 69 74 | 68 69 6e 20 61 20 6c 61 |cts' wit|hin a la|
|000016a0| 72 67 65 72 20 70 72 6f | 67 72 61 6d 0d 0a 28 74 |rger pro|gram..(t|
|000016b0| 68 65 73 65 20 61 72 65 | 20 75 73 75 61 6c 6c 79 |hese are| usually|
|000016c0| 20 72 65 66 65 72 72 65 | 64 20 74 6f 20 61 73 20 | referre|d to as |
|000016d0| 7b 5c 65 6d 20 61 74 6f | 6d 73 7d 20 69 6e 20 72 |{\em ato|ms} in r|
|000016e0| 65 6c 61 74 65 64 0d 0a | 6c 69 74 65 72 61 74 75 |elated..|literatu|
|000016f0| 72 65 29 2e 20 53 75 63 | 68 20 61 20 73 63 68 65 |re). Suc|h a sche|
|00001700| 6d 65 20 69 73 20 61 70 | 70 72 6f 70 72 69 61 74 |me is ap|propriat|
|00001710| 65 20 66 6f 72 20 6d 61 | 6e 79 20 73 79 73 74 65 |e for ma|ny syste|
|00001720| 6d 0d 0a 61 64 6d 69 6e | 69 73 74 72 61 74 69 6f |m..admin|istratio|
|00001730| 6e 20 73 63 72 69 70 74 | 73 20 77 68 69 63 68 20 |n script|s which |
|00001740| 62 75 6e 64 6c 65 20 72 | 65 73 6f 75 72 63 65 2d |bundle r|esource-|
|00001750| 69 6e 64 65 70 65 6e 64 | 65 6e 74 0d 0a 6f 70 65 |independ|ent..ope|
|00001760| 72 61 74 69 6f 6e 73 2e | 20 57 65 20 61 69 6d 20 |rations.| We aim |
|00001770| 74 6f 20 63 72 65 61 74 | 65 20 61 20 6d 6f 72 65 |to creat|e a more|
|00001780| 20 69 6e 74 65 6c 6c 69 | 67 65 6e 74 20 61 70 70 | intelli|gent app|
|00001790| 72 6f 61 63 68 20 74 6f | 20 74 68 65 0d 0a 6c 6f |roach to| the..lo|
|000017a0| 63 6b 69 6e 67 20 70 72 | 6f 62 6c 65 6d 2c 20 77 |cking pr|oblem, w|
|000017b0| 68 69 63 68 20 69 73 20 | 72 6f 62 75 73 74 20 74 |hich is |robust t|
|000017c0| 6f 20 75 6e 70 72 65 64 | 69 63 74 61 62 6c 65 20 |o unpred|ictable |
|000017d0| 66 61 69 6c 75 72 65 73 | 20 61 6e 64 20 77 68 69 |failures| and whi|
|000017e0| 63 68 0d 0a 70 72 6f 76 | 69 64 65 73 20 63 65 72 |ch..prov|ides cer|
|000017f0| 74 61 69 6e 20 61 73 73 | 75 72 61 6e 63 65 73 20 |tain ass|urances |
|00001800| 61 67 61 69 6e 73 74 20 | 68 61 6e 67 69 6e 67 20 |against |hanging |
|00001810| 70 72 6f 63 65 73 73 65 | 73 20 6f 72 20 66 61 69 |processe|s or fai|
|00001820| 6c 75 72 65 20 74 6f 0d | 0a 65 78 65 63 75 74 65 |lure to.|.execute|
|00001830| 2e 20 20 57 65 20 64 6f | 20 6e 6f 74 20 65 78 63 |. We do| not exc|
|00001840| 6c 75 64 65 20 6d 75 6c | 74 69 70 6c 65 20 69 6e |lude mul|tiple in|
|00001850| 73 74 61 6e 74 69 61 74 | 69 6f 6e 73 20 6f 66 20 |stantiat|ions of |
|00001860| 70 72 6f 67 72 61 6d 73 | 0d 0a 72 75 6e 6e 69 6e |programs|..runnin|
|00001870| 67 20 69 6e 20 64 69 66 | 66 65 72 65 6e 74 20 74 |g in dif|ferent t|
|00001880| 68 72 65 61 64 73 2c 20 | 62 75 74 20 69 6e 73 74 |hreads, |but inst|
|00001890| 65 61 64 20 74 72 79 20 | 74 6f 20 65 6e 73 75 72 |ead try |to ensur|
|000018a0| 65 20 74 68 61 74 20 74 | 68 65 79 0d 0a 63 6f 6f |e that t|hey..coo|
|000018b0| 70 65 72 61 74 65 20 72 | 61 74 68 65 72 20 74 68 |perate r|ather th|
|000018c0| 61 6e 20 63 6f 6e 74 65 | 6e 64 2e 20 54 68 65 20 |an conte|nd. The |
|000018d0| 67 72 61 6e 75 6c 61 72 | 69 74 79 20 6f 66 20 74 |granular|ity of t|
|000018e0| 68 65 20 6c 6f 63 6b 69 | 6e 67 20 73 63 68 65 6d |he locki|ng schem|
|000018f0| 65 0d 0a 68 61 73 20 74 | 6f 20 62 65 20 63 68 6f |e..has t|o be cho|
|00001900| 73 65 6e 20 63 61 72 65 | 66 75 6c 6c 79 20 74 6f |sen care|fully to|
|00001910| 20 61 63 68 69 65 76 65 | 20 73 65 6e 73 69 62 6c | achieve| sensibl|
|00001920| 65 20 61 6e 64 20 70 72 | 65 64 69 63 74 61 62 6c |e and pr|edictabl|
|00001930| 65 0d 0a 62 65 68 61 76 | 69 6f 75 72 20 61 6e 64 |e..behav|iour and|
|00001940| 20 77 65 20 74 61 6b 65 | 20 73 6f 6d 65 20 74 69 | we take| some ti|
|00001950| 6d 65 20 74 6f 20 64 65 | 73 63 72 69 62 65 20 74 |me to de|scribe t|
|00001960| 68 65 20 62 65 68 61 76 | 69 6f 75 72 20 69 6e 20 |he behav|iour in |
|00001970| 64 65 74 61 69 6c 2e 0d | 0a 0d 0a 54 68 65 20 6c |detail..|...The l|
|00001980| 6f 63 6b 69 6e 67 20 73 | 65 6d 61 6e 74 69 63 73 |ocking s|emantics|
|00001990| 20 77 65 20 64 65 73 63 | 72 69 62 65 20 68 65 72 | we desc|ribe her|
|000019a0| 65 20 61 72 65 20 6d 6f | 74 69 76 61 74 65 64 20 |e are mo|tivated |
|000019b0| 62 79 20 6f 75 72 20 64 | 65 73 69 72 65 20 74 6f |by our d|esire to|
|000019c0| 0d 0a 65 71 75 69 70 20 | 74 68 65 20 73 79 73 74 |..equip |the syst|
|000019d0| 65 6d 20 61 64 6d 69 6e | 69 73 74 72 61 74 69 6f |em admin|istratio|
|000019e0| 6e 20 72 6f 62 6f 74 20 | 7b 5c 74 74 0d 0a 63 66 |n robot |{\tt..cf|
|000019f0| 65 6e 67 69 6e 65 7d 5c | 63 69 74 65 7b 63 66 31 |engine}\|cite{cf1|
|00001a00| 2c 63 66 32 2c 63 66 33 | 2c 63 66 34 7d 20 77 69 |,cf2,cf3|,cf4} wi|
|00001a10| 74 68 20 61 20 66 6c 65 | 78 69 62 6c 65 20 62 75 |th a fle|xible bu|
|00001a20| 74 20 61 75 74 6f 6e 6f | 6d 6f 75 73 0d 0a 6d 65 |t autono|mous..me|
|00001a30| 63 68 61 6e 69 73 6d 20 | 66 6f 72 20 61 76 6f 69 |chanism |for avoi|
|00001a40| 64 69 6e 67 20 63 6f 6e | 74 65 6e 74 69 6f 6e 20 |ding con|tention |
|00001a50| 61 6e 64 20 73 70 61 6d | 6d 69 6e 67 20 69 6e 20 |and spam|ming in |
|00001a60| 61 20 64 69 73 74 72 69 | 62 75 74 65 64 2c 0d 0a |a distri|buted,..|
|00001a70| 6d 75 6c 74 69 74 68 72 | 65 61 64 65 64 20 65 6e |multithr|eaded en|
|00001a80| 76 69 72 6f 6e 6d 65 6e | 74 2e 20 42 79 20 69 6e |vironmen|t. By in|
|00001a90| 74 72 6f 64 75 63 69 6e | 67 20 6f 75 72 20 6e 65 |troducin|g our ne|
|00001aa0| 77 20 6c 6f 63 6b 69 6e | 67 20 70 6f 6c 69 63 79 |w lockin|g policy|
|00001ab0| 2c 0d 0a 63 66 65 6e 67 | 69 6e 65 20 63 61 6e 20 |,..cfeng|ine can |
|00001ac0| 66 75 6e 63 74 69 6f 6e | 20 61 73 20 61 6e 20 69 |function| as an i|
|00001ad0| 6e 74 65 67 72 61 74 65 | 64 20 66 72 6f 6e 74 2d |ntegrate|d front-|
|00001ae0| 65 6e 64 20 66 6f 72 20 | 63 72 6f 6e 20 61 6e 64 |end for |cron and|
|00001af0| 0d 0a 6e 65 74 77 6f 72 | 6b 2d 69 6e 69 74 69 61 |..networ|k-initia|
|00001b00| 74 65 64 20 73 63 72 69 | 70 74 73 2c 20 65 66 66 |ted scri|pts, eff|
|00001b10| 65 63 74 69 76 65 6c 79 | 20 63 72 65 61 74 69 6e |ectively| creatin|
|00001b20| 67 20 61 20 73 69 6e 67 | 6c 65 20 6e 65 74 77 6f |g a sing|le netwo|
|00001b30| 72 6b 2d 77 69 64 65 0d | 0a 66 69 6c 65 20 66 6f |rk-wide.|.file fo|
|00001b40| 72 20 73 74 61 72 74 69 | 6e 67 20 72 65 67 75 6c |r starti|ng regul|
|00001b50| 61 72 20 61 6e 64 20 69 | 6e 74 65 72 6d 69 74 74 |ar and i|ntermitt|
|00001b60| 65 6e 74 6c 79 20 73 63 | 68 65 64 75 6c 65 64 20 |ently sc|heduled |
|00001b70| 70 72 6f 67 72 61 6d 73 | 20 77 68 69 63 68 0d 0a |programs| which..|
|00001b80| 69 73 20 70 72 6f 74 65 | 63 74 65 64 20 61 67 61 |is prote|cted aga|
|00001b90| 69 6e 73 74 20 73 70 61 | 6d 6d 69 6e 67 20 61 74 |inst spa|mming at|
|00001ba0| 74 61 63 6b 73 20 6f 72 | 20 61 63 63 69 64 65 6e |tacks or| acciden|
|00001bb0| 74 61 6c 0d 0a 72 65 70 | 65 74 69 74 69 6f 6e 2e |tal..rep|etition.|
|00001bc0| 20 41 6c 74 68 6f 75 67 | 68 20 69 6e 74 65 6e 64 | Althoug|h intend|
|00001bd0| 65 64 20 66 6f 72 20 63 | 66 65 6e 67 69 6e 65 2c |ed for c|fengine,|
|00001be0| 20 74 68 65 20 6c 6f 63 | 6b 69 6e 67 20 70 6f 6c | the loc|king pol|
|00001bf0| 69 63 79 20 77 65 20 68 | 61 76 65 0d 0a 61 72 72 |icy we h|ave..arr|
|00001c00| 69 76 65 64 20 61 74 20 | 69 73 20 61 70 70 6c 69 |ived at |is appli|
|00001c10| 63 61 62 6c 65 20 74 6f | 20 61 6e 79 20 73 69 74 |cable to| any sit|
|00001c20| 75 61 74 69 6f 6e 20 77 | 68 65 72 65 20 70 72 6f |uation w|here pro|
|00001c30| 67 72 61 6d 73 20 61 72 | 65 20 73 63 68 65 64 75 |grams ar|e schedu|
|00001c40| 6c 65 64 0d 0a 6f 6e 20 | 61 20 74 69 6d 65 20 73 |led..on |a time s|
|00001c50| 63 61 6c 65 20 77 68 69 | 63 68 20 69 73 20 63 6f |cale whi|ch is co|
|00001c60| 6d 70 61 72 61 62 6c 65 | 20 74 6f 20 74 68 65 69 |mparable| to thei|
|00001c70| 72 20 72 75 6e 74 69 6d | 65 2e 20 54 68 65 79 20 |r runtim|e. They |
|00001c80| 77 6f 75 6c 64 20 62 65 | 0d 0a 70 61 72 74 69 63 |would be|..partic|
|00001c90| 75 6c 61 72 6c 79 20 75 | 73 65 66 75 6c 20 61 73 |ularly u|seful as|
|00001ca0| 20 61 6e 20 61 64 64 69 | 74 69 6f 6e 20 74 6f 20 | an addi|tion to |
|00001cb0| 73 63 72 69 70 74 69 6e | 67 20 6c 61 6e 67 75 61 |scriptin|g langua|
|00001cc0| 67 65 73 20 73 75 63 68 | 20 61 73 0d 0a 50 65 72 |ges such| as..Per|
|00001cd0| 6c 2c 20 47 75 69 6c 65 | 2c 20 54 63 6c 20 61 6e |l, Guile|, Tcl an|
|00001ce0| 64 20 65 76 65 6e 20 4a | 61 76 61 2e 0d 0a 0d 0a |d even J|ava.....|
|00001cf0| 54 72 61 64 69 74 69 6f | 6e 61 6c 6c 79 20 61 74 |Traditio|nally at|
|00001d00| 74 65 6e 74 69 6f 6e 20 | 68 61 73 20 62 65 65 6e |tention |has been|
|00001d10| 20 67 69 76 65 6e 20 69 | 6e 20 74 68 65 20 6c 69 | given i|n the li|
|00001d20| 74 65 72 61 74 75 72 65 | 20 74 6f 20 74 68 65 0d |terature| to the.|
|00001d30| 0a 70 72 6f 62 6c 65 6d | 20 6f 66 20 6c 6f 63 6b |.problem| of lock|
|00001d40| 69 6e 67 20 6f 66 20 73 | 68 61 72 65 64 20 6d 65 |ing of s|hared me|
|00001d50| 6d 6f 72 79 20 72 65 73 | 6f 75 72 63 65 73 20 61 |mory res|ources a|
|00001d60| 6e 64 20 63 6f 6e 63 75 | 72 72 65 6e 74 20 64 61 |nd concu|rrent da|
|00001d70| 74 61 62 61 73 65 0d 0a | 74 72 61 6e 73 61 63 74 |tabase..|transact|
|00001d80| 69 6f 6e 73 20 75 73 69 | 6e 67 20 64 69 73 63 72 |ions usi|ng discr|
|00001d90| 65 74 69 6f 6e 61 72 79 | 20 6c 6f 63 6b 73 2c 20 |etionary| locks, |
|00001da0| 6d 75 74 65 78 65 73 2c | 20 73 65 6d 61 70 68 6f |mutexes,| semapho|
|00001db0| 72 65 73 20 61 6e 64 0d | 0a 6d 6f 6e 69 74 6f 72 |res and.|.monitor|
|00001dc0| 73 5c 63 69 74 65 7b 74 | 61 6e 65 6e 62 61 75 6d |s\cite{t|anenbaum|
|00001dd0| 31 2c 74 72 61 6e 73 61 | 63 74 69 6f 6e 73 7d 2e |1,transa|ctions}.|
|00001de0| 20 52 65 73 6f 75 72 63 | 65 20 6c 6f 63 6b 73 20 | Resourc|e locks |
|00001df0| 69 6e 20 64 69 73 74 72 | 69 62 75 74 65 64 0d 0a |in distr|ibuted..|
|00001e00| 73 79 73 74 65 6d 73 20 | 68 61 76 65 20 61 6c 73 |systems |have als|
|00001e10| 6f 20 62 65 65 6e 20 64 | 69 73 63 75 73 73 65 64 |o been d|iscussed|
|00001e20| 20 69 6e 20 63 6f 6e 6e | 65 63 74 69 6f 6e 20 77 | in conn|ection w|
|00001e30| 69 74 68 20 66 72 61 67 | 69 6c 65 0d 0a 63 6f 6d |ith frag|ile..com|
|00001e40| 6d 75 6e 69 63 61 74 69 | 6f 6e 20 6c 69 6e 6b 73 |municati|on links|
|00001e50| 5c 63 69 74 65 7b 61 64 | 61 70 74 69 76 65 2c 63 |\cite{ad|aptive,c|
|00001e60| 6f 6e 63 75 72 72 65 6e | 74 6c 6f 63 6b 7d 20 61 |oncurren|tlock} a|
|00001e70| 6e 64 20 69 6e 64 65 70 | 65 6e 64 65 6e 74 0d 0a |nd indep|endent..|
|00001e80| 70 61 72 61 6c 5c 2d 6c | 65 6c 69 73 6d 5c 63 69 |paral\-l|elism\ci|
|00001e90| 74 65 7b 77 61 69 74 66 | 72 65 65 7d 2e 20 41 70 |te{waitf|ree}. Ap|
|00001ea0| 70 6c 69 63 61 74 69 6f | 6e 20 6c 6f 63 6b 73 20 |plicatio|n locks |
|00001eb0| 64 6f 20 6e 6f 74 20 73 | 65 65 6d 20 74 6f 20 68 |do not s|eem to h|
|00001ec0| 61 76 65 0d 0a 65 6e 6a | 6f 79 65 64 20 74 68 65 |ave..enj|oyed the|
|00001ed0| 20 73 61 6d 65 20 69 6e | 74 65 72 65 73 74 20 69 | same in|terest i|
|00001ee0| 6e 20 74 68 65 20 6c 69 | 74 65 72 61 74 75 72 65 |n the li|terature|
|00001ef0| 2c 20 70 65 72 68 61 70 | 73 20 62 65 63 61 75 73 |, perhap|s becaus|
|00001f00| 65 20 6f 66 20 74 68 65 | 69 72 0d 0a 61 70 70 61 |e of the|ir..appa|
|00001f10| 72 65 6e 74 20 74 72 69 | 76 69 61 6c 69 74 79 2c |rent tri|viality,|
|00001f20| 20 62 75 74 20 74 68 65 | 79 20 61 72 65 20 77 69 | but the|y are wi|
|00001f30| 64 65 6c 79 20 75 73 65 | 64 20 69 6e 20 63 6f 6e |dely use|d in con|
|00001f40| 63 75 72 72 65 6e 74 20 | 61 6e 64 20 73 68 61 72 |current |and shar|
|00001f50| 65 64 0d 0a 61 70 70 6c | 69 63 61 74 69 6f 6e 73 |ed..appl|ications|
|00001f60| 20 61 6e 64 20 61 72 65 | 20 63 6c 6f 73 65 6c 79 | and are| closely|
|00001f70| 20 72 65 6c 61 74 65 64 | 20 74 6f 20 61 6c 6c 20 | related| to all |
|00001f80| 6f 66 20 74 68 65 20 61 | 62 6f 76 65 20 69 73 73 |of the a|bove iss|
|00001f90| 75 65 73 2e 0d 0a 0d 0a | 49 6e 20 74 68 65 20 70 |ues.....|In the p|
|00001fa0| 72 65 73 65 6e 74 20 77 | 6f 72 6b 20 77 65 20 77 |resent w|ork we w|
|00001fb0| 69 73 68 20 74 6f 20 69 | 6c 6c 75 73 74 72 61 74 |ish to i|llustrat|
|00001fc0| 65 20 68 6f 77 20 61 20 | 73 69 6d 70 6c 65 20 6d |e how a |simple m|
|00001fd0| 6f 64 69 66 69 63 61 74 | 69 6f 6e 20 6f 66 0d 0a |odificat|ion of..|
|00001fe0| 74 68 65 20 6d 6f 73 74 | 20 74 72 69 76 69 61 6c |the most| trivial|
|00001ff0| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 20 6c 6f 63 | applica|tion loc|
|00002000| 6b 73 20 63 61 6e 20 6c | 65 61 64 20 74 6f 20 65 |ks can l|ead to e|
|00002010| 6e 68 61 6e 63 65 64 20 | 61 75 74 6f 6e 6f 6d 79 |nhanced |autonomy|
|00002020| 20 6f 66 0d 0a 73 63 68 | 65 64 75 6c 65 64 20 73 | of..sch|eduled s|
|00002030| 79 73 74 65 6d 73 2e 20 | 20 42 79 20 69 6d 70 6c |ystems. | By impl|
|00002040| 65 6d 65 6e 74 69 6e 67 | 20 73 75 63 68 20 6c 6f |ementing| such lo|
|00002050| 63 6b 73 20 69 6e 20 74 | 68 65 20 61 75 74 6f 6d |cks in t|he autom|
|00002060| 61 74 65 64 20 73 79 73 | 74 65 6d 0d 0a 61 64 6d |ated sys|tem..adm|
|00002070| 69 6e 69 73 74 72 61 74 | 69 6f 6e 20 72 6f 62 6f |inistrat|ion robo|
|00002080| 74 20 63 66 65 6e 67 69 | 6e 65 20 77 65 20 73 68 |t cfengi|ne we sh|
|00002090| 6f 77 20 68 6f 77 20 74 | 68 69 73 20 69 73 20 64 |ow how t|his is d|
|000020a0| 69 72 65 63 74 6c 79 20 | 72 65 6c 65 76 61 6e 74 |irectly |relevant|
|000020b0| 20 74 6f 0d 0a 74 68 65 | 20 72 65 6c 69 61 62 69 | to..the| reliabi|
|000020c0| 6c 69 74 79 20 6f 66 20 | 61 75 74 6f 6d 61 74 65 |lity of |automate|
|000020d0| 64 20 73 79 73 74 65 6d | 20 61 64 6d 69 6e 69 73 |d system| adminis|
|000020e0| 74 72 61 74 69 6f 6e 2e | 20 20 4f 75 72 20 6c 6f |tration.| Our lo|
|000020f0| 63 6b 73 20 61 72 65 20 | 61 0d 0a 67 65 6e 65 72 |cks are |a..gener|
|00002100| 61 6c 69 7a 61 74 69 6f | 6e 20 6f 66 20 74 68 65 |alizatio|n of the|
|00002110| 20 63 6f 6e 63 75 72 72 | 65 6e 74 20 6c 6f 63 6b | concurr|ent lock|
|00002120| 20 63 6f 6e 63 65 70 74 | 2c 20 69 67 6e 6f 72 69 | concept|, ignori|
|00002130| 6e 67 20 74 68 65 20 73 | 74 72 6f 6e 67 0d 0a 6f |ng the s|trong..o|
|00002140| 72 64 65 72 69 6e 67 20 | 6f 66 20 74 68 65 20 61 |rdering |of the a|
|00002150| 74 6f 6d 73 2c 20 62 75 | 74 20 69 6e 63 6c 75 64 |toms, bu|t includ|
|00002160| 69 6e 67 20 67 61 72 62 | 61 67 65 20 63 6f 6c 6c |ing garb|age coll|
|00002170| 65 63 74 69 6f 6e 20 61 | 6e 64 20 70 72 6f 74 65 |ection a|nd prote|
|00002180| 63 74 69 6f 6e 0d 0a 61 | 67 61 69 6e 73 74 20 75 |ction..a|gainst u|
|00002190| 6e 64 65 73 69 72 61 62 | 6c 65 20 72 65 70 65 74 |ndesirab|le repet|
|000021a0| 69 74 69 6f 6e 2e 0d 0a | 0d 0a 5c 73 65 63 74 69 |ition...|..\secti|
|000021b0| 6f 6e 7b 4c 6f 63 6b 69 | 6e 67 20 73 65 6d 61 6e |on{Locki|ng seman|
|000021c0| 74 69 63 73 7d 0d 0a 0d | 0a 41 6c 6c 20 6c 6f 63 |tics}...|.All loc|
|000021d0| 6b 69 6e 67 20 62 65 67 | 69 6e 73 20 62 79 20 64 |king beg|ins by d|
|000021e0| 65 66 69 6e 69 6e 67 20 | 7b 5c 65 6d 20 61 74 6f |efining |{\em ato|
|000021f0| 6d 69 63 20 6f 70 65 72 | 61 74 69 6f 6e 73 7d 2c |mic oper|ations},|
|00002200| 20 6f 72 20 63 72 69 74 | 69 63 61 6c 0d 0a 73 65 | or crit|ical..se|
|00002210| 63 74 69 6f 6e 73 3a 20 | 74 68 65 73 65 20 61 72 |ctions: |these ar|
|00002220| 65 20 74 68 65 20 62 61 | 73 69 63 20 70 69 65 63 |e the ba|sic piec|
|00002230| 65 73 20 6f 66 20 61 20 | 70 72 6f 67 72 61 6d 20 |es of a |program |
|00002240| 74 68 61 74 20 6d 75 73 | 74 20 72 75 6e 20 74 6f |that mus|t run to|
|00002250| 0d 0a 63 6f 6d 70 6c 65 | 74 69 6f 6e 2c 20 77 69 |..comple|tion, wi|
|00002260| 74 68 6f 75 74 20 74 68 | 65 20 64 69 73 74 75 72 |thout th|e distur|
|00002270| 62 61 6e 63 65 20 66 72 | 6f 6d 20 74 68 69 72 64 |bance fr|om third|
|00002280| 20 70 61 72 74 69 65 73 | 2e 20 49 6e 20 6f 74 68 | parties|. In oth|
|00002290| 65 72 0d 0a 77 6f 72 64 | 73 2c 20 61 74 6f 6d 73 |er..word|s, atoms|
|000022a0| 20 61 72 65 20 61 6c 6c | 2d 6f 72 2d 6e 6f 74 68 | are all|-or-noth|
|000022b0| 69 6e 67 20 70 69 65 63 | 65 73 20 6f 66 20 61 20 |ing piec|es of a |
|000022c0| 70 72 6f 67 72 61 6d 2e | 20 41 74 6f 6d 73 20 61 |program.| Atoms a|
|000022d0| 72 65 0d 0a 70 72 6f 74 | 65 63 74 65 64 20 62 79 |re..prot|ected by|
|000022e0| 20 7b 5c 74 74 20 47 65 | 74 4c 6f 63 6b 28 29 7d | {\tt Ge|tLock()}|
|000022f0| 2c 20 7b 5c 74 74 20 52 | 65 6c 65 61 73 65 43 75 |, {\tt R|eleaseCu|
|00002300| 72 72 65 6e 74 4c 6f 63 | 6b 28 29 7d 20 70 61 72 |rrentLoc|k()} par|
|00002310| 65 6e 74 68 65 73 65 73 | 20 77 69 74 68 69 6e 0d |entheses| within.|
|00002320| 0a 74 68 65 20 70 72 6f | 67 72 61 6d 20 63 6f 64 |.the pro|gram cod|
|00002330| 65 2e 0d 0a 0d 0a 5c 62 | 65 67 69 6e 7b 76 65 72 |e.....\b|egin{ver|
|00002340| 73 65 7d 0d 0a 7b 5c 74 | 74 20 47 65 74 4c 6f 63 |se}..{\t|t GetLoc|
|00002350| 6b 7d 28 7b 5c 65 6d 20 | 70 61 72 61 6d 65 74 65 |k}({\em |paramete|
|00002360| 72 73 7d 29 5c 5c 0d 0a | 7e 5c 5c 0d 0a 7e 7e 7e |rs})\\..|~\\..~~~|
|00002370| 7e 20 20 2f 2a 20 41 74 | 6f 6d 20 63 6f 64 65 20 |~ /* At|om code |
|00002380| 2a 2f 5c 5c 0d 0a 7e 5c | 5c 0d 0a 7b 5c 74 74 20 |*/\\..~\|\..{\tt |
|00002390| 52 65 6c 65 61 73 65 43 | 75 72 72 65 6e 74 4c 6f |ReleaseC|urrentLo|
|000023a0| 63 6b 7d 28 29 0d 0a 5c | 65 6e 64 7b 76 65 72 73 |ck}()..\|end{vers|
|000023b0| 65 7d 0d 0a 0d 0a 53 65 | 72 69 61 6c 69 7a 65 64 |e}....Se|rialized|
|000023c0| 20 61 63 63 65 73 73 20 | 74 6f 20 74 68 65 73 65 | access |to these|
|000023d0| 20 61 74 6f 6d 73 20 69 | 73 20 61 73 73 75 72 65 | atoms i|s assure|
|000023e0| 64 20 62 79 20 65 6e 63 | 61 70 73 75 6c 61 74 69 |d by enc|apsulati|
|000023f0| 6e 67 20 65 61 63 68 20 | 6f 6e 65 0d 0a 77 69 74 |ng each |one..wit|
|00002400| 68 20 61 6e 20 65 78 63 | 6c 75 73 69 76 65 20 6c |h an exc|lusive l|
|00002410| 6f 63 6b 2e 20 20 54 6f | 20 63 72 65 61 74 65 20 |ock. To| create |
|00002420| 61 20 6c 6f 63 6b 69 6e | 67 20 70 6f 6c 69 63 79 |a lockin|g policy|
|00002430| 2c 20 6f 6e 65 20 6d 75 | 73 74 20 66 69 6e 64 20 |, one mu|st find |
|00002440| 74 68 65 0d 0a 6d 6f 73 | 74 20 65 66 66 69 63 69 |the..mos|t effici|
|00002450| 65 6e 74 20 77 61 79 20 | 6f 66 20 69 6d 70 6c 65 |ent way |of imple|
|00002460| 6d 65 6e 74 69 6e 67 20 | 72 65 73 6f 75 72 63 65 |menting |resource|
|00002470| 20 63 6f 6e 74 72 6f 6c | 2e 20 49 66 20 77 65 20 | control|. If we |
|00002480| 6c 6f 63 6b 0d 0a 6f 62 | 6a 65 63 74 73 20 77 68 |lock..ob|jects wh|
|00002490| 69 63 68 20 61 72 65 20 | 74 6f 6f 20 70 72 69 6d |ich are |too prim|
|000024a0| 69 74 69 76 65 20 28 66 | 69 6e 65 20 67 72 61 69 |itive (f|ine grai|
|000024b0| 6e 29 2c 20 77 65 20 72 | 69 73 6b 20 73 74 61 72 |n), we r|isk star|
|000024c0| 74 69 6e 67 0d 0a 70 72 | 6f 67 72 61 6d 73 20 77 |ting..pr|ograms w|
|000024d0| 68 69 63 68 20 77 69 6c | 6c 20 6f 6e 6c 79 20 72 |hich wil|l only r|
|000024e0| 75 6e 20 70 61 72 74 69 | 61 6c 6c 79 2c 20 75 6e |un parti|ally, un|
|000024f0| 61 62 6c 65 20 74 6f 20 | 63 6f 6d 70 6c 65 74 65 |able to |complete|
|00002500| 20 62 65 63 61 75 73 65 | 20 6f 66 0d 0a 62 75 73 | because| of..bus|
|00002510| 79 20 72 65 73 6f 75 72 | 63 65 73 2e 20 54 68 69 |y resour|ces. Thi|
|00002520| 73 20 77 6f 75 6c 64 20 | 73 69 6d 70 6c 79 20 63 |s would |simply c|
|00002530| 6f 6e 73 74 69 74 75 74 | 65 20 61 20 77 61 73 74 |onstitut|e a wast|
|00002540| 65 20 6f 66 20 43 50 55 | 20 74 69 6d 65 2e 20 4f |e of CPU| time. O|
|00002550| 6e 0d 0a 74 68 65 20 6f | 74 68 65 72 20 68 61 6e |n..the o|ther han|
|00002560| 64 2c 20 69 66 20 77 65 | 20 6c 6f 63 6b 20 6f 62 |d, if we| lock ob|
|00002570| 6a 65 63 74 73 20 77 68 | 69 63 68 20 61 72 65 20 |jects wh|ich are |
|00002580| 74 6f 6f 20 63 6f 61 72 | 73 65 2c 20 6c 6f 67 69 |too coar|se, logi|
|00002590| 63 61 6c 6c 79 0d 0a 69 | 6e 64 65 70 65 6e 64 65 |cally..i|ndepende|
|000025a0| 6e 74 20 70 61 72 74 73 | 20 6f 66 20 74 68 65 20 |nt parts| of the |
|000025b0| 70 72 6f 67 72 61 6d 20 | 77 69 6c 6c 20 6e 6f 74 |program |will not|
|000025c0| 20 62 65 20 73 74 61 72 | 74 65 64 20 61 74 20 61 | be star|ted at a|
|000025d0| 6c 6c 2e 20 54 68 69 73 | 20 69 73 0d 0a 75 6e 6e |ll. This| is..unn|
|000025e0| 65 63 65 73 73 61 72 79 | 20 61 6e 64 20 69 6e 65 |ecessary| and ine|
|000025f0| 66 66 69 63 69 65 6e 74 | 2e 20 49 6e 20 61 20 63 |fficient|. In a c|
|00002600| 6f 6e 63 75 72 72 65 6e | 74 20 65 6e 76 69 72 6f |oncurren|t enviro|
|00002610| 6e 6d 65 6e 74 20 74 68 | 65 72 65 20 69 73 20 6e |nment th|ere is n|
|00002620| 6f 0d 0a 72 65 61 73 6f | 6e 20 77 68 79 20 69 6e |o..reaso|n why in|
|00002630| 64 65 70 65 6e 64 65 6e | 74 20 61 74 6f 6d 73 20 |dependen|t atoms |
|00002640| 63 6f 75 6c 64 20 6e 6f | 74 20 72 75 6e 20 69 6e |could no|t run in|
|00002650| 20 73 65 70 61 72 61 74 | 65 20 74 68 72 65 61 64 | separat|e thread|
|00002660| 73 2c 0d 0a 61 6c 6c 6f | 77 69 6e 67 20 73 65 76 |s,..allo|wing sev|
|00002670| 65 72 61 6c 20 69 6e 73 | 74 61 6e 74 69 61 74 69 |eral ins|tantiati|
|00002680| 6f 6e 73 20 6f 66 20 61 | 20 62 61 74 63 68 20 70 |ons of a| batch p|
|00002690| 72 6f 67 72 61 6d 20 74 | 6f 20 60 66 6c 6f 77 20 |rogram t|o `flow |
|000026a0| 74 68 72 6f 75 67 68 27 | 0d 0a 6f 6e 65 20 61 6e |through'|..one an|
|000026b0| 6f 74 68 65 72 2e 20 54 | 68 69 73 20 61 73 73 75 |other. T|his assu|
|000026c0| 6d 65 73 20 68 6f 77 65 | 76 65 72 20 74 68 61 74 |mes howe|ver that|
|000026d0| 20 74 68 65 20 6f 72 64 | 65 72 20 6f 66 20 74 68 | the ord|er of th|
|000026e0| 65 20 61 74 6f 6d 73 20 | 69 73 20 6e 6f 74 0d 0a |e atoms |is not..|
|000026f0| 69 6d 70 6f 72 74 61 6e | 74 2e 0d 0a 0d 0a 42 79 |importan|t.....By|
|00002700| 20 64 65 66 69 6e 69 6e | 67 20 73 75 69 74 61 62 | definin|g suitab|
|00002710| 6c 65 20 61 74 6f 6d 73 | 20 74 6f 20 6c 6f 63 6b |le atoms| to lock|
|00002720| 2c 20 6f 6e 65 20 69 73 | 20 61 62 6c 65 20 74 6f |, one is| able to|
|00002730| 20 6f 70 74 69 6d 69 7a | 65 20 74 68 65 0d 0a 65 | optimiz|e the..e|
|00002740| 78 65 63 75 74 69 6f 6e | 20 6f 66 20 74 68 65 20 |xecution| of the |
|00002750| 74 61 73 6b 73 20 69 6e | 20 61 20 70 72 6f 67 72 |tasks in| a progr|
|00002760| 61 6d 2e 20 20 53 65 76 | 65 72 61 6c 20 61 70 70 |am. Sev|eral app|
|00002770| 72 6f 61 63 68 65 73 20 | 74 6f 20 6c 6f 63 6b 69 |roaches |to locki|
|00002780| 6e 67 0d 0a 6d 61 79 20 | 62 65 20 63 6f 6e 73 69 |ng..may |be consi|
|00002790| 64 65 72 65 64 2e 20 41 | 20 6c 6f 63 6b 2d 6d 61 |dered. A| lock-ma|
|000027a0| 6e 61 67 65 72 20 64 61 | 65 6d 6f 6e 20 69 73 20 |nager da|emon is |
|000027b0| 6f 6e 65 20 70 6f 73 73 | 69 62 69 6c 69 74 79 2e |one poss|ibility.|
|000027c0| 20 54 68 69 73 20 69 73 | 0d 0a 61 6e 61 6c 6f 67 | This is|..analog|
|000027d0| 6f 75 73 20 74 6f 20 6d | 61 6e 79 20 6e 65 74 77 |ous to m|any netw|
|000027e0| 6f 72 6b 20 6c 69 63 65 | 6e 73 65 20 64 61 65 6d |ork lice|nse daem|
|000027f0| 6f 6e 73 3a 20 61 20 64 | 61 65 6d 6f 6e 20 68 61 |ons: a d|aemon ha|
|00002800| 6e 64 73 20 6f 75 74 20 | 74 69 63 6b 65 74 73 0d |nds out |tickets.|
|00002810| 0a 77 68 69 63 68 20 61 | 72 65 20 76 61 6c 69 64 |.which a|re valid|
|00002820| 20 66 6f 72 20 61 20 63 | 65 72 74 61 69 6e 20 6c | for a c|ertain l|
|00002830| 69 66 65 74 69 6d 65 2e | 20 41 66 74 65 72 20 74 |ifetime.| After t|
|00002840| 68 65 20 74 69 63 6b 65 | 74 20 65 78 70 69 72 65 |he ticke|t expire|
|00002850| 73 2c 20 74 68 65 0d 0a | 70 72 6f 67 72 61 6d 20 |s, the..|program |
|00002860| 69 73 20 63 6f 6e 73 69 | 64 65 72 65 64 20 6f 76 |is consi|dered ov|
|00002870| 65 72 64 75 65 20 61 6e | 64 20 73 68 6f 75 6c 64 |erdue an|d should|
|00002880| 20 62 65 20 6b 69 6c 6c | 65 64 2e 20 20 41 20 6d | be kill|ed. A m|
|00002890| 61 6a 6f 72 20 70 72 6f | 62 6c 65 6d 0d 0a 77 69 |ajor pro|blem..wi|
|000028a0| 74 68 20 61 20 64 61 65 | 6d 6f 6e 20 62 61 73 65 |th a dae|mon base|
|000028b0| 64 20 6c 6f 63 6b 69 6e | 67 20 6d 65 63 68 61 6e |d lockin|g mechan|
|000028c0| 69 73 6d 20 69 73 20 74 | 68 61 74 20 69 74 20 69 |ism is t|hat it i|
|000028d0| 73 20 68 69 67 68 6c 79 | 20 74 69 6d 65 0d 0a 63 |s highly| time..c|
|000028e0| 6f 6e 73 75 6d 69 6e 67 | 20 61 6e 64 20 74 68 61 |onsuming| and tha|
|000028f0| 74 20 69 74 20 69 73 20 | 73 75 73 63 65 70 74 69 |t it is |suscepti|
|00002900| 62 6c 65 20 74 6f 20 70 | 72 65 63 69 73 65 6c 79 |ble to p|recisely|
|00002910| 20 74 68 65 20 73 61 6d | 65 20 70 72 6f 62 6c 65 | the sam|e proble|
|00002920| 6d 73 20 61 73 0d 0a 74 | 68 6f 73 65 20 77 68 69 |ms as..t|hose whi|
|00002930| 63 68 20 63 61 75 73 65 | 20 74 68 65 20 75 6e 63 |ch cause| the unc|
|00002940| 65 72 74 61 69 6e 74 79 | 20 6f 6e 20 70 72 6f 67 |ertainty| on prog|
|00002950| 72 61 6d 20 72 75 6e 74 | 69 6d 65 73 2e 20 55 73 |ram runt|imes. Us|
|00002960| 65 20 6f 66 20 7b 5c 74 | 74 0d 0a 66 6c 6f 63 6b |e of {\t|t..flock|
|00002970| 28 29 7d 20 69 73 20 61 | 6e 6f 74 68 65 72 20 70 |()} is a|nother p|
|00002980| 6f 73 73 69 62 69 6c 69 | 74 79 2c 20 62 75 74 20 |ossibili|ty, but |
|00002990| 74 68 69 73 20 69 73 20 | 6e 6f 74 20 63 6f 6d 70 |this is |not comp|
|000029a0| 6c 65 74 65 6c 79 0d 0a | 70 6f 72 74 61 62 6c 65 |letely..|portable|
|000029b0| 2e 20 41 20 72 65 61 6c | 69 73 74 69 63 20 61 70 |. A real|istic ap|
|000029c0| 70 72 6f 61 63 68 20 6e | 65 65 64 73 20 74 6f 20 |proach n|eeds to |
|000029d0| 62 65 20 6d 6f 72 65 20 | 63 6f 6d 70 61 63 74 20 |be more |compact |
|000029e0| 61 6e 64 20 65 66 66 69 | 63 69 65 6e 74 2e 0d 0a |and effi|cient...|
|000029f0| 0d 0a 5c 73 65 63 74 69 | 6f 6e 7b 49 6d 70 6c 65 |..\secti|on{Imple|
|00002a00| 6d 65 6e 74 61 74 69 6f | 6e 7d 0d 0a 0d 0a 57 65 |mentatio|n}....We|
|00002a10| 20 68 61 76 65 20 63 68 | 6f 73 65 6e 20 74 6f 20 | have ch|osen to |
|00002a20| 69 6d 70 6c 65 6d 65 6e | 74 20 6c 6f 63 6b 73 20 |implemen|t locks |
|00002a30| 75 73 69 6e 67 20 72 65 | 67 75 6c 61 72 20 66 69 |using re|gular fi|
|00002a40| 6c 65 73 20 61 6e 64 20 | 69 6e 64 65 78 20 6e 6f |les and |index no|
|00002a50| 64 65 73 2e 0d 0a 42 79 | 20 75 73 69 6e 67 20 61 |des...By| using a|
|00002a60| 20 75 6e 69 71 75 65 20 | 6e 61 6d 69 6e 67 20 61 | unique |naming a|
|00002a70| 6c 67 6f 72 69 74 68 6d | 2c 20 77 65 20 61 72 65 |lgorithm|, we are|
|00002a80| 20 61 62 6c 65 20 74 6f | 20 69 6e 73 74 61 6e 74 | able to| instant|
|00002a90| 6c 79 20 60 6b 6e 6f 77 | 27 0d 0a 74 68 65 20 6e |ly `know|'..the n|
|00002aa0| 61 6d 65 20 6f 66 20 61 | 20 6c 6f 63 6b 20 77 69 |ame of a| lock wi|
|00002ab0| 74 68 6f 75 74 20 68 61 | 76 69 6e 67 20 74 6f 20 |thout ha|ving to |
|00002ac0| 73 65 61 72 63 68 20 66 | 6f 72 20 69 74 20 6f 72 |search f|or it or|
|00002ad0| 20 61 73 6b 20 61 20 6d | 61 6e 61 67 65 72 0d 0a | ask a m|anager..|
|00002ae0| 66 6f 72 20 74 68 65 20 | 64 61 74 61 2e 20 54 68 |for the |data. Th|
|00002af0| 69 73 20 6d 69 6e 69 6d | 69 7a 65 73 20 74 69 6d |is minim|izes tim|
|00002b00| 65 20 63 6f 6e 73 75 6d | 69 6e 67 20 63 61 6c 6c |e consum|ing call|
|00002b10| 73 20 74 6f 20 74 68 65 | 20 6e 65 74 77 6f 72 6b |s to the| network|
|00002b20| 20 6f 72 20 74 6f 0d 0a | 64 69 73 6b 2e 0d 0a 0d | or to..|disk....|
|00002b30| 0a 49 6e 20 6f 72 64 65 | 72 20 74 6f 20 73 65 63 |.In orde|r to sec|
|00002b40| 75 72 65 20 61 20 75 6e | 69 71 75 65 20 6e 61 6d |ure a un|ique nam|
|00002b50| 65 2c 20 77 65 20 6e 65 | 65 64 20 74 6f 20 70 72 |e, we ne|ed to pr|
|00002b60| 6f 76 69 64 65 20 65 6e | 6f 75 67 68 0d 0a 69 6e |ovide en|ough..in|
|00002b70| 66 6f 72 6d 61 74 69 6f | 6e 20 74 6f 20 62 65 20 |formatio|n to be |
|00002b80| 61 62 6c 65 20 74 6f 20 | 69 64 65 6e 74 69 66 79 |able to |identify|
|00002b90| 20 65 61 63 68 20 61 74 | 6f 6d 20 75 6e 69 71 75 | each at|om uniqu|
|00002ba0| 65 6c 79 2e 20 54 68 69 | 73 20 69 73 0d 0a 70 72 |ely. Thi|s is..pr|
|00002bb0| 65 73 65 6e 74 6c 79 20 | 61 63 63 6f 6d 70 6c 69 |esently |accompli|
|00002bc0| 73 68 65 64 20 62 79 20 | 70 61 73 73 69 6e 67 20 |shed by |passing |
|00002bd0| 61 20 73 74 72 69 6e 67 | 20 74 6f 20 74 68 65 20 |a string| to the |
|00002be0| 6c 6f 63 6b 20 66 75 6e | 63 74 69 6f 6e 20 77 68 |lock fun|ction wh|
|00002bf0| 69 63 68 0d 0a 63 61 6e | 20 62 65 20 63 6f 6d 62 |ich..can| be comb|
|00002c00| 69 6e 65 64 20 77 69 74 | 68 20 6f 74 68 65 72 20 |ined wit|h other |
|00002c10| 65 6c 65 6d 65 6e 74 73 | 20 73 75 63 68 20 61 73 |elements| such as|
|00002c20| 20 74 68 65 20 68 6f 73 | 74 20 6f 6e 20 77 68 69 | the hos|t on whi|
|00002c30| 63 68 20 74 68 65 20 6c | 6f 63 6b 0d 0a 77 61 73 |ch the l|ock..was|
|00002c40| 20 63 72 65 61 74 65 64 | 20 61 6e 64 20 61 6e 79 | created| and any|
|00002c50| 20 6f 74 68 65 72 20 72 | 65 6c 65 76 61 6e 74 20 | other r|elevant |
|00002c60| 69 6e 66 6f 72 6d 61 74 | 69 6f 6e 2e 20 46 6f 72 |informat|ion. For|
|00002c70| 20 63 6f 6e 76 65 6e 69 | 65 6e 63 65 20 77 65 0d | conveni|ence we.|
|00002c80| 0a 63 6c 61 73 73 69 66 | 79 20 61 74 6f 6d 73 20 |.classif|y atoms |
|00002c90| 77 69 74 68 20 61 6e 20 | 6f 70 65 72 61 74 6f 72 |with an |operator|
|00002ca0| 2f 6f 70 65 72 61 6e 64 | 20 70 61 69 72 2e 20 46 |/operand| pair. F|
|00002cb0| 6f 72 20 65 78 61 6d 70 | 6c 65 2c 20 63 6f 6e 73 |or examp|le, cons|
|00002cc0| 69 64 65 72 20 61 0d 0a | 6c 6f 63 6b 20 72 65 71 |ider a..|lock req|
|00002cd0| 75 65 73 74 20 74 6f 20 | 65 64 69 74 20 61 20 66 |uest to |edit a f|
|00002ce0| 69 6c 65 2e 20 49 6e 20 | 74 68 69 73 20 63 61 73 |ile. In |this cas|
|00002cf0| 65 20 74 68 65 20 6f 70 | 65 72 61 74 6f 72 20 77 |e the op|erator w|
|00002d00| 6f 75 6c 64 20 62 65 0d | 0a 60 60 65 64 69 74 27 |ould be.|.``edit'|
|00002d10| 27 20 61 6e 64 20 74 68 | 65 20 6f 70 65 72 61 6e |' and th|e operan|
|00002d20| 64 20 77 6f 75 6c 64 20 | 62 65 20 74 68 65 20 6e |d would |be the n|
|00002d30| 61 6d 65 20 6f 66 20 74 | 68 65 20 66 69 6c 65 2e |ame of t|he file.|
|00002d40| 20 54 68 65 20 6e 61 6d | 65 73 20 6d 75 73 74 0d | The nam|es must.|
|00002d50| 0a 62 65 20 70 72 6f 63 | 65 73 73 65 64 20 74 6f |.be proc|essed to|
|00002d60| 20 65 78 70 75 6e 67 65 | 20 75 6e 66 6f 72 74 75 | expunge| unfortu|
|00002d70| 6e 61 74 65 20 63 68 61 | 72 61 63 74 65 72 73 20 |nate cha|racters |
|00002d80| 77 68 69 63 68 20 77 6f | 75 6c 64 20 6c 65 61 64 |which wo|uld lead|
|00002d90| 20 74 6f 0d 0a 69 6c 6c | 65 67 61 6c 20 66 69 6c | to..ill|egal fil|
|00002da0| 65 20 6e 61 6d 65 73 2e | 0d 0a 0d 0a 5c 73 6d 61 |e names.|....\sma|
|00002db0| 6c 6c 0d 0a 5c 62 65 67 | 69 6e 7b 76 65 72 62 61 |ll..\beg|in{verba|
|00002dc0| 74 69 6d 7d 0d 0a 20 20 | 20 20 43 61 6e 6f 6e 69 |tim}.. | Canoni|
|00002dd0| 66 79 4e 61 6d 65 28 63 | 68 61 72 20 2a 62 75 66 |fyName(c|har *buf|
|00002de0| 66 65 72 29 0d 0a 20 20 | 20 20 7b 0d 0a 20 20 20 |fer).. | {.. |
|00002df0| 20 66 6f 72 20 28 73 70 | 20 3d 20 62 75 66 66 65 | for (sp| = buffe|
|00002e00| 72 3b 20 2a 73 70 20 21 | 3d 20 27 5c 30 27 3b 20 |r; *sp !|= '\0'; |
|00002e10| 73 70 2b 2b 29 0d 0a 20 | 20 20 20 20 20 20 7b 0d |sp++).. | {.|
|00002e20| 0a 20 20 20 20 20 20 20 | 69 66 20 28 21 69 73 61 |. |if (!isa|
|00002e30| 6c 6e 75 6d 28 2a 73 70 | 29 29 0d 0a 20 20 20 20 |lnum(*sp|)).. |
|00002e40| 20 20 20 20 20 20 7b 0d | 0a 20 20 20 20 20 20 20 | {.|. |
|00002e50| 20 20 20 2a 73 70 20 3d | 20 27 5f 27 3b 0d 0a 20 | *sp =| '_';.. |
|00002e60| 20 20 20 20 20 20 20 20 | 20 7d 0d 0a 20 20 20 20 | | }.. |
|00002e70| 20 20 20 7d 0d 0a 20 20 | 20 20 7d 0d 0a 5c 65 6e | }.. | }..\en|
|00002e80| 64 7b 76 65 72 62 61 74 | 69 6d 7d 0d 0a 5c 6e 6f |d{verbat|im}..\no|
|00002e90| 72 6d 61 6c 73 69 7a 65 | 0d 0a 0d 0a 57 65 20 75 |rmalsize|....We u|
|00002ea0| 73 65 20 61 20 66 75 6e | 63 74 69 6f 6e 20 7b 5c |se a fun|ction {\|
|00002eb0| 74 74 20 43 61 6e 6f 6e | 69 66 79 4e 61 6d 65 7d |tt Canon|ifyName}|
|00002ec0| 28 7b 5c 65 6d 20 6e 61 | 6d 65 7d 29 20 77 68 69 |({\em na|me}) whi|
|00002ed0| 63 68 20 72 65 74 75 72 | 6e 73 20 61 0d 0a 73 74 |ch retur|ns a..st|
|00002ee0| 72 69 6e 67 20 73 75 69 | 74 61 62 6c 65 20 66 6f |ring sui|table fo|
|00002ef0| 72 20 75 73 65 20 61 73 | 20 61 20 66 69 6c 65 6e |r use as| a filen|
|00002f00| 61 6d 65 2e 20 49 74 20 | 73 75 66 66 69 63 65 73 |ame. It |suffices|
|00002f10| 20 74 6f 20 73 77 61 70 | 20 69 6c 6c 65 67 61 6c | to swap| illegal|
|00002f20| 0d 0a 63 68 61 72 61 63 | 74 65 72 73 20 66 6f 72 |..charac|ters for|
|00002f30| 20 61 6e 20 75 6e 64 65 | 72 73 63 6f 72 65 2c 20 | an unde|rscore, |
|00002f40| 66 6f 72 20 69 6e 73 74 | 61 6e 63 65 2e 0d 0a 0d |for inst|ance....|
|00002f50| 0a 49 6e 20 6f 72 64 65 | 72 20 74 6f 20 66 75 6e |.In orde|r to fun|
|00002f60| 63 74 69 6f 6e 20 70 72 | 6f 70 65 72 6c 79 2c 20 |ction pr|operly, |
|00002f70| 74 68 65 20 6c 6f 63 6b | 2d 6e 61 6d 65 20 6d 75 |the lock|-name mu|
|00002f80| 73 74 20 62 65 20 64 69 | 66 66 65 72 65 6e 74 20 |st be di|fferent |
|00002f90| 66 6f 72 0d 0a 65 61 63 | 68 20 64 69 73 74 69 6e |for..eac|h distin|
|00002fa0| 63 74 20 61 74 6f 6d 2c | 20 62 75 74 20 6d 75 73 |ct atom,| but mus|
|00002fb0| 74 20 62 65 20 63 6f 6e | 73 74 61 6e 74 20 6f 76 |t be con|stant ov|
|00002fc0| 65 72 20 74 69 6d 65 20 | 73 6f 20 74 68 61 74 20 |er time |so that |
|00002fd0| 6d 75 6c 74 69 70 6c 65 | 0d 0a 69 6e 73 74 61 6e |multiple|..instan|
|00002fe0| 74 69 61 74 69 6f 6e 73 | 20 6f 66 20 74 68 65 20 |tiations| of the |
|00002ff0| 70 72 6f 67 72 61 6d 20 | 77 69 6c 6c 20 61 6c 77 |program |will alw|
|00003000| 61 79 73 20 66 69 6e 64 | 20 74 68 65 20 73 61 6d |ays find| the sam|
|00003010| 65 20 6c 6f 63 6b 2e 20 | 54 68 65 20 74 69 6d 65 |e lock. |The time|
|00003020| 0d 0a 69 6e 66 6f 72 6d | 61 74 69 6f 6e 20 73 68 |..inform|ation sh|
|00003030| 6f 75 6c 64 20 74 68 65 | 72 65 66 6f 72 65 20 6e |ould the|refore n|
|00003040| 6f 74 20 62 65 20 63 6f | 64 65 64 20 69 6e 74 6f |ot be co|ded into|
|00003050| 20 74 68 65 20 6e 61 6d | 65 20 6f 66 20 74 68 65 | the nam|e of the|
|00003060| 20 6c 6f 63 6b 3b 0d 0a | 69 6e 73 74 65 61 64 2c | lock;..|instead,|
|00003070| 20 6f 6e 65 20 72 65 6c | 69 65 73 20 6f 6e 20 74 | one rel|ies on t|
|00003080| 68 65 20 74 69 6d 65 20 | 73 74 61 6d 70 73 20 6f |he time |stamps o|
|00003090| 6e 20 74 68 65 20 69 6e | 6f 64 65 73 20 74 6f 20 |n the in|odes to |
|000030a0| 64 65 74 65 72 6d 69 6e | 65 0d 0a 74 68 65 69 72 |determin|e..their|
|000030b0| 20 61 67 65 2e 20 46 6f | 72 20 65 78 61 6d 70 6c | age. Fo|r exampl|
|000030c0| 65 2c 20 77 68 65 6e 20 | 65 64 69 74 69 6e 67 20 |e, when |editing |
|000030d0| 74 68 65 20 66 69 6c 65 | 20 7b 5c 74 74 20 2f 65 |the file| {\tt /e|
|000030e0| 74 63 2f 6d 6f 74 64 7d | 20 6f 6e 20 68 6f 73 74 |tc/motd}| on host|
|000030f0| 0d 0a 7b 5c 74 74 20 64 | 61 78 7d 2c 20 61 20 6c |..{\tt d|ax}, a l|
|00003100| 6f 63 6b 20 6e 61 6d 65 | 64 0d 0a 0d 0a 5c 62 65 |ock name|d....\be|
|00003110| 67 69 6e 7b 76 65 72 62 | 61 74 69 6d 7d 0d 0a 20 |gin{verb|atim}.. |
|00003120| 6c 6f 63 6b 2e 63 66 65 | 6e 67 69 6e 65 5f 63 6f |lock.cfe|ngine_co|
|00003130| 6e 66 2e 64 61 78 2e 65 | 64 69 74 66 69 6c 65 2e |nf.dax.e|ditfile.|
|00003140| 5f 65 74 63 5f 6d 6f 74 | 64 20 0d 0a 5c 65 6e 64 |_etc_mot|d ..\end|
|00003150| 7b 76 65 72 62 61 74 69 | 6d 7d 0d 0a 0d 0a 5c 6e |{verbati|m}....\n|
|00003160| 6f 69 6e 64 65 6e 74 0d | 0a 77 6f 75 6c 64 20 62 |oindent.|.would b|
|00003170| 65 20 63 72 65 61 74 65 | 64 2e 0d 0a 0d 0a 57 65 |e create|d.....We|
|00003180| 20 63 72 65 61 74 65 20 | 74 77 6f 20 6b 69 6e 64 | create |two kind|
|00003190| 73 20 6f 66 20 6c 6f 63 | 6b 20 77 69 74 68 69 6e |s of loc|k within|
|000031a0| 20 74 68 65 20 7b 5c 74 | 74 20 47 65 74 4c 6f 63 | the {\t|t GetLoc|
|000031b0| 6b 28 29 7d 20 63 61 6c | 6c 3a 20 61 20 6c 6f 63 |k()} cal|l: a loc|
|000031c0| 6b 0d 0a 66 6f 72 20 61 | 63 74 69 76 65 20 74 68 |k..for a|ctive th|
|000031d0| 72 65 61 64 73 20 6f 66 | 20 65 78 65 63 75 74 69 |reads of| executi|
|000031e0| 6f 6e 20 77 68 69 63 68 | 20 62 6c 6f 63 6b 73 20 |on which| blocks |
|000031f0| 6d 75 6c 74 69 70 6c 65 | 20 69 6e 73 74 61 6e 74 |multiple| instant|
|00003200| 69 61 74 69 6f 6e 73 0d | 0a 6f 66 20 61 20 70 72 |iations.|.of a pr|
|00003210| 6f 63 65 73 73 2c 20 61 | 6e 64 20 61 20 70 65 72 |ocess, a|nd a per|
|00003220| 6d 61 6e 65 6e 74 20 6c | 6f 63 6b 20 77 68 69 63 |manent l|ock whic|
|00003230| 68 20 72 65 63 6f 72 64 | 73 20 74 68 65 20 6c 61 |h record|s the la|
|00003240| 73 74 20 74 69 6d 65 20 | 61 74 0d 0a 77 68 69 63 |st time |at..whic|
|00003250| 68 20 74 68 65 20 72 65 | 73 6f 75 72 63 65 20 77 |h the re|source w|
|00003260| 61 73 20 61 63 63 65 73 | 73 65 64 2e 20 53 65 65 |as acces|sed. See|
|00003270| 20 66 69 67 75 72 65 20 | 5c 72 65 66 7b 63 6f 6d | figure |\ref{com|
|00003280| 70 6f 6e 65 6e 74 73 7d | 2e 20 54 68 65 0d 0a 6c |ponents}|. The..l|
|00003290| 61 74 74 65 72 20 69 6e | 66 6f 72 6d 61 74 69 6f |atter in|formatio|
|000032a0| 6e 20 63 61 6e 20 62 65 | 20 65 6e 63 61 70 73 75 |n can be| encapsu|
|000032b0| 6c 61 74 65 64 20 69 6e | 20 61 20 73 69 6e 67 6c |lated in| a singl|
|000032c0| 65 20 69 6e 6f 64 65 20 | 77 69 74 68 6f 75 74 20 |e inode |without |
|000032d0| 75 73 69 6e 67 0d 0a 61 | 6e 79 20 64 69 73 6b 20 |using..a|ny disk |
|000032e0| 62 6c 6f 63 6b 73 20 61 | 6e 64 20 70 72 6f 76 69 |blocks a|nd provi|
|000032f0| 64 65 73 20 74 68 65 20 | 69 6e 66 6f 72 6d 61 74 |des the |informat|
|00003300| 69 6f 6e 20 6e 65 63 65 | 73 73 61 72 79 20 74 6f |ion nece|ssary to|
|00003310| 20 72 65 73 74 72 69 63 | 74 20 74 68 65 0d 0a 66 | restric|t the..f|
|00003320| 72 65 71 75 65 6e 63 79 | 20 6f 66 20 61 63 63 65 |requency| of acce|
|00003330| 73 73 2e 20 57 65 20 63 | 61 6c 6c 20 74 68 69 73 |ss. We c|all this|
|00003340| 20 61 6e 20 61 6e 74 69 | 2d 73 70 61 6d 6d 69 6e | an anti|-spammin|
|00003350| 67 20 6c 6f 63 6b 2e 0d | 0a 0d 0a 5c 62 65 67 69 |g lock..|...\begi|
|00003360| 6e 7b 66 69 67 75 72 65 | 7d 5b 68 74 5d 0d 0a 5c |n{figure|}[ht]..\|
|00003370| 63 65 6e 74 65 72 6c 69 | 6e 65 7b 0d 0a 5c 62 65 |centerli|ne{..\be|
|00003380| 67 69 6e 7b 70 69 63 74 | 75 72 65 7d 28 31 39 30 |gin{pict|ure}(190|
|00003390| 2c 31 30 30 29 28 30 2c | 30 29 0d 0a 5c 70 75 74 |,100)(0,|0)..\put|
|000033a0| 28 31 30 30 2c 38 30 29 | 7b 5c 6f 76 61 6c 28 38 |(100,80)|{\oval(8|
|000033b0| 30 2c 34 30 29 7d 0d 0a | 5c 70 75 74 28 31 30 30 |0,40)}..|\put(100|
|000033c0| 2c 38 30 29 7b 5c 6d 61 | 6b 65 62 6f 78 28 30 2c |,80){\ma|kebox(0,|
|000033d0| 30 29 7b 41 74 6f 6d 7d | 7d 0d 0a 5c 70 75 74 28 |0){Atom}|}..\put(|
|000033e0| 20 20 30 2c 31 29 7b 5c | 66 72 61 6d 65 62 6f 78 | 0,1){\|framebox|
|000033f0| 28 37 30 2c 33 30 29 7b | 4c 61 73 74 20 6c 6f 63 |(70,30){|Last loc|
|00003400| 6b 7d 7d 0d 0a 5c 70 75 | 74 28 31 32 30 2c 31 29 |k}}..\pu|t(120,1)|
|00003410| 7b 5c 64 61 73 68 62 6f | 78 7b 33 7d 28 37 30 2c |{\dashbo|x{3}(70,|
|00003420| 33 30 29 7b 41 63 74 69 | 76 65 20 6c 6f 63 6b 7d |30){Acti|ve lock}|
|00003430| 7d 0d 0a 5c 70 75 74 28 | 31 30 30 2c 35 39 29 7b |}..\put(|100,59){|
|00003440| 5c 76 65 63 74 6f 72 28 | 2d 32 2c 2d 31 29 7b 35 |\vector(|-2,-1){5|
|00003450| 33 7d 7d 0d 0a 5c 70 75 | 74 28 31 30 30 2c 35 39 |3}}..\pu|t(100,59|
|00003460| 29 7b 5c 76 65 63 74 6f | 72 28 20 32 2c 2d 31 29 |){\vecto|r( 2,-1)|
|00003470| 7b 35 33 7d 7d 0d 0a 5c | 65 6e 64 7b 70 69 63 74 |{53}}..\|end{pict|
|00003480| 75 72 65 7d 0d 0a 7d 0d | 0a 5c 63 61 70 74 69 6f |ure}..}.|.\captio|
|00003490| 6e 7b 54 68 65 20 61 64 | 61 70 74 69 76 65 20 6c |n{The ad|aptive l|
|000034a0| 6f 63 6b 20 63 6f 6d 70 | 6f 6e 65 6e 74 73 20 66 |ock comp|onents f|
|000034b0| 6f 72 20 61 6e 20 61 74 | 6f 6d 2e 7d 0d 0a 5c 6c |or an at|om.}..\l|
|000034c0| 61 62 65 6c 7b 63 6f 6d | 70 6f 6e 65 6e 74 73 7d |abel{com|ponents}|
|000034d0| 0d 0a 5c 65 6e 64 7b 66 | 69 67 75 72 65 7d 0d 0a |..\end{f|igure}..|
|000034e0| 0d 0a 49 66 20 61 20 6c | 6f 63 6b 20 61 6c 72 65 |..If a l|ock alre|
|000034f0| 61 64 79 20 65 78 69 73 | 74 73 20 66 6f 72 20 61 |ady exis|ts for a|
|00003500| 20 73 70 65 63 69 66 69 | 65 64 20 61 74 6f 6d 2c | specifi|ed atom,|
|00003510| 20 61 6e 64 20 74 68 61 | 74 20 6c 6f 63 6b 20 68 | and tha|t lock h|
|00003520| 61 73 20 6e 6f 74 0d 0a | 65 78 70 69 72 65 64 2c |as not..|expired,|
|00003530| 20 74 68 65 20 61 74 6f | 6d 20 72 65 6d 61 69 6e | the ato|m remain|
|00003540| 73 20 6c 6f 63 6b 65 64 | 20 61 6e 64 20 61 63 63 |s locked| and acc|
|00003550| 65 73 73 20 74 6f 20 74 | 68 65 20 61 74 6f 6d 20 |ess to t|he atom |
|00003560| 69 73 20 64 65 6e 69 65 | 64 2e 0d 0a 4c 6f 63 6b |is denie|d...Lock|
|00003570| 20 65 78 70 69 72 79 20 | 6f 63 63 75 72 73 20 77 | expiry |occurs w|
|00003580| 68 65 6e 20 61 20 63 65 | 72 74 61 69 6e 20 70 72 |hen a ce|rtain pr|
|00003590| 65 64 65 66 69 6e 65 64 | 20 70 65 72 69 6f 64 20 |edefined| period |
|000035a0| 6f 66 20 74 69 6d 65 20 | 68 61 73 0d 0a 65 6c 61 |of time |has..ela|
|000035b0| 70 73 65 64 20 73 69 6e | 63 65 20 74 68 65 20 61 |psed sin|ce the a|
|000035c0| 63 74 69 76 65 20 6c 6f | 63 6b 20 77 61 73 20 63 |ctive lo|ck was c|
|000035d0| 72 65 61 74 65 64 2e 20 | 49 6e 20 74 68 69 73 20 |reated. |In this |
|000035e0| 63 61 73 65 2c 20 61 20 | 67 61 72 62 61 67 65 0d |case, a |garbage.|
|000035f0| 0a 63 6f 6c 6c 65 63 74 | 69 6f 6e 20 6d 65 63 68 |.collect|ion mech|
|00003600| 61 6e 69 73 6d 20 61 74 | 74 65 6d 70 74 73 20 74 |anism at|tempts t|
|00003610| 6f 20 63 61 72 65 66 75 | 6c 6c 79 20 65 6c 69 6d |o carefu|lly elim|
|00003620| 69 6e 61 74 65 20 74 68 | 65 20 70 72 6f 63 65 73 |inate th|e proces|
|00003630| 73 0d 0a 61 74 74 61 63 | 68 65 64 20 74 6f 20 74 |s..attac|hed to t|
|00003640| 68 65 20 68 61 6e 67 69 | 6e 67 20 6c 6f 63 6b 20 |he hangi|ng lock |
|00003650| 28 69 66 20 69 74 20 73 | 74 69 6c 6c 20 65 78 69 |(if it s|till exi|
|00003660| 73 74 73 29 20 61 6e 64 | 20 74 68 65 6e 20 72 65 |sts) and| then re|
|00003670| 6d 6f 76 65 20 74 68 65 | 0d 0a 6f 6c 64 20 6c 6f |move the|..old lo|
|00003680| 63 6b 2c 20 72 65 70 6c | 61 63 69 6e 67 20 69 74 |ck, repl|acing it|
|00003690| 20 77 69 74 68 20 61 20 | 6e 65 77 20 6f 6e 65 20 | with a |new one |
|000036a0| 61 6e 64 20 70 65 72 6d | 69 74 74 69 6e 67 20 74 |and perm|itting t|
|000036b0| 68 65 20 6b 69 6c 6c 69 | 6e 67 0d 0a 70 72 6f 63 |he killi|ng..proc|
|000036c0| 65 73 73 20 74 6f 20 74 | 61 6b 65 20 6f 76 65 72 |ess to t|ake over|
|000036d0| 20 74 68 65 20 74 61 73 | 6b 2e 20 20 54 68 65 20 | the tas|k. The |
|000036e0| 74 68 69 72 64 20 70 6f | 73 73 69 62 69 6c 69 74 |third po|ssibilit|
|000036f0| 79 20 69 73 20 74 68 61 | 74 20 6e 6f 0d 0a 61 63 |y is tha|t no..ac|
|00003700| 74 69 76 65 20 6c 6f 63 | 6b 20 65 78 69 73 74 73 |tive loc|k exists|
|00003710| 20 66 6f 72 20 61 6e 20 | 61 74 6f 6d 2c 20 62 75 | for an |atom, bu|
|00003720| 74 20 74 68 61 74 20 74 | 68 65 20 74 69 6d 65 20 |t that t|he time |
|00003730| 73 69 6e 63 65 20 69 74 | 73 20 70 72 65 76 69 6f |since it|s previo|
|00003740| 75 73 0d 0a 65 78 65 63 | 75 74 69 6f 6e 20 69 73 |us..exec|ution is|
|00003750| 20 74 6f 6f 20 73 68 6f | 72 74 2e 20 20 54 68 69 | too sho|rt. Thi|
|00003760| 73 20 69 6e 66 6f 72 6d | 61 74 69 6f 6e 20 69 73 |s inform|ation is|
|00003770| 20 67 6c 65 61 6e 65 64 | 20 66 72 6f 6d 20 74 68 | gleaned| from th|
|00003780| 65 0d 0a 70 65 72 6d 61 | 6e 65 6e 74 20 6c 6f 63 |e..perma|nent loc|
|00003790| 6b 2e 20 49 6e 20 74 68 | 61 74 20 63 61 73 65 20 |k. In th|at case |
|000037a0| 61 63 63 65 73 73 20 74 | 6f 20 74 68 65 20 61 74 |access t|o the at|
|000037b0| 6f 6d 20 69 73 20 61 6c | 73 6f 20 64 65 6e 69 65 |om is al|so denie|
|000037c0| 64 2e 20 54 68 69 73 0d | 0a 66 65 61 74 75 72 65 |d. This.|.feature|
|000037d0| 20 67 69 76 65 73 20 75 | 73 20 74 68 65 20 60 61 | gives u|s the `a|
|000037e0| 6e 74 69 2d 73 70 61 6d | 6d 69 6e 67 27 20 66 75 |nti-spam|ming' fu|
|000037f0| 6e 63 74 69 6f 6e 61 6c | 69 74 79 2e 0d 0a 0d 0a |nctional|ity.....|
|00003800| 5c 62 65 67 69 6e 7b 66 | 69 67 75 72 65 2a 7d 0d |\begin{f|igure*}.|
|00003810| 0a 5c 63 65 6e 74 65 72 | 6c 69 6e 65 7b 0d 0a 5c |.\center|line{..\|
|00003820| 62 65 67 69 6e 7b 70 69 | 63 74 75 72 65 7d 28 34 |begin{pi|cture}(4|
|00003830| 30 30 2c 32 31 33 29 28 | 30 2c 30 29 0d 0a 5c 70 |00,213)(|0,0)..\p|
|00003840| 75 74 28 30 2c 31 32 29 | 7b 5c 76 65 63 74 6f 72 |ut(0,12)|{\vector|
|00003850| 28 31 2c 30 29 7b 34 30 | 30 7d 7d 0d 0a 25 5c 70 |(1,0){40|0}}..%\p|
|00003860| 75 74 28 30 2c 31 32 29 | 7b 5c 76 65 63 74 6f 72 |ut(0,12)|{\vector|
|00003870| 28 30 2c 31 29 7b 38 34 | 7d 7d 0d 0a 5c 70 75 74 |(0,1){84|}}..\put|
|00003880| 28 35 30 2c 30 29 7b 24 | 5c 44 65 6c 74 61 20 74 |(50,0){$|\Delta t|
|00003890| 24 7d 0d 0a 5c 70 75 74 | 28 31 35 30 2c 30 29 7b |$}..\put|(150,0){|
|000038a0| 24 5c 44 65 6c 74 61 20 | 74 24 7d 0d 0a 5c 70 75 |$\Delta |t$}..\pu|
|000038b0| 74 28 32 35 30 2c 30 29 | 7b 24 5c 44 65 6c 74 61 |t(250,0)|{$\Delta|
|000038c0| 20 74 24 7d 0d 0a 5c 70 | 75 74 28 33 35 30 2c 30 | t$}..\p|ut(350,0|
|000038d0| 29 7b 24 5c 44 65 6c 74 | 61 20 74 24 7d 0d 0a 25 |){$\Delt|a t$}..%|
|000038e0| 0d 0a 5c 70 75 74 28 20 | 20 30 2c 38 29 7b 5c 6c |..\put( | 0,8){\l|
|000038f0| 69 6e 65 28 30 2c 31 29 | 7b 38 7d 7d 0d 0a 5c 70 |ine(0,1)|{8}}..\p|
|00003900| 75 74 28 31 30 30 2c 38 | 29 7b 5c 6c 69 6e 65 28 |ut(100,8|){\line(|
|00003910| 30 2c 31 29 7b 38 7d 7d | 0d 0a 5c 70 75 74 28 32 |0,1){8}}|..\put(2|
|00003920| 30 30 2c 38 29 7b 5c 6c | 69 6e 65 28 30 2c 31 29 |00,8){\l|ine(0,1)|
|00003930| 7b 38 7d 7d 0d 0a 5c 70 | 75 74 28 33 30 30 2c 38 |{8}}..\p|ut(300,8|
|00003940| 29 7b 5c 6c 69 6e 65 28 | 30 2c 31 29 7b 38 7d 7d |){\line(|0,1){8}}|
|00003950| 0d 0a 5c 6d 75 6c 74 69 | 70 75 74 28 20 20 30 2c |..\multi|put( 0,|
|00003960| 38 29 28 30 2c 33 29 7b | 36 39 7d 7b 5c 6c 69 6e |8)(0,3){|69}{\lin|
|00003970| 65 28 30 2c 31 29 7b 30 | 2e 33 7d 7d 0d 0a 5c 6d |e(0,1){0|.3}}..\m|
|00003980| 75 6c 74 69 70 75 74 28 | 31 30 30 2c 38 29 28 30 |ultiput(|100,8)(0|
|00003990| 2c 33 29 7b 36 39 7d 7b | 5c 6c 69 6e 65 28 30 2c |,3){69}{|\line(0,|
|000039a0| 31 29 7b 30 2e 33 7d 7d | 0d 0a 5c 6d 75 6c 74 69 |1){0.3}}|..\multi|
|000039b0| 70 75 74 28 32 30 30 2c | 38 29 28 30 2c 33 29 7b |put(200,|8)(0,3){|
|000039c0| 33 32 7d 7b 5c 6c 69 6e | 65 28 30 2c 31 29 7b 30 |32}{\lin|e(0,1){0|
|000039d0| 2e 33 7d 7d 0d 0a 5c 6d | 75 6c 74 69 70 75 74 28 |.3}}..\m|ultiput(|
|000039e0| 32 30 30 2c 31 32 39 29 | 28 30 2c 33 29 7b 32 39 |200,129)|(0,3){29|
|000039f0| 7d 7b 5c 6c 69 6e 65 28 | 30 2c 31 29 7b 30 2e 33 |}{\line(|0,1){0.3|
|00003a00| 7d 7d 0d 0a 5c 6d 75 6c | 74 69 70 75 74 28 33 30 |}}..\mul|tiput(30|
|00003a10| 30 2c 38 29 28 30 2c 33 | 29 7b 33 32 7d 7b 5c 6c |0,8)(0,3|){32}{\l|
|00003a20| 69 6e 65 28 30 2c 31 29 | 7b 30 2e 33 7d 7d 0d 0a |ine(0,1)|{0.3}}..|
|00003a30| 5c 6d 75 6c 74 69 70 75 | 74 28 33 30 30 2c 31 32 |\multipu|t(300,12|
|00003a40| 39 29 28 30 2c 33 29 7b | 32 39 7d 7b 5c 6c 69 6e |9)(0,3){|29}{\lin|
|00003a50| 65 28 30 2c 31 29 7b 30 | 2e 33 7d 7d 0d 0a 25 0d |e(0,1){0|.3}}..%.|
|00003a60| 0a 5c 70 75 74 28 31 30 | 2c 35 34 29 7b 5c 76 65 |.\put(10|,54){\ve|
|00003a70| 63 74 6f 72 28 2d 31 2c | 30 29 7b 31 30 7d 7d 0d |ctor(-1,|0){10}}.|
|00003a80| 0a 5c 70 75 74 28 20 30 | 2c 35 30 29 7b 5c 6c 69 |.\put( 0|,50){\li|
|00003a90| 6e 65 28 30 2c 31 29 7b | 38 7d 7d 0d 0a 5c 70 75 |ne(0,1){|8}}..\pu|
|00003aa0| 74 28 35 38 2c 35 34 29 | 7b 5c 76 65 63 74 6f 72 |t(58,54)|{\vector|
|00003ab0| 28 20 31 2c 30 29 7b 31 | 30 7d 7d 0d 0a 5c 70 75 |( 1,0){1|0}}..\pu|
|00003ac0| 74 28 36 38 2c 35 30 29 | 7b 5c 6c 69 6e 65 28 30 |t(68,50)|{\line(0|
|00003ad0| 2c 31 29 7b 38 7d 7d 0d | 0a 5c 70 75 74 28 31 30 |,1){8}}.|.\put(10|
|00003ae0| 2c 35 31 29 7b 7b 5c 74 | 74 20 49 66 45 6c 61 70 |,51){{\t|t IfElap|
|00003af0| 73 65 64 7d 7d 0d 0a 25 | 0d 0a 5c 70 75 74 28 31 |sed}}..%|..\put(1|
|00003b00| 35 39 2c 31 33 38 29 7b | 5c 76 65 63 74 6f 72 28 |59,138){|\vector(|
|00003b10| 2d 31 2c 30 29 7b 35 39 | 7d 7d 0d 0a 5c 70 75 74 |-1,0){59|}}..\put|
|00003b20| 28 31 30 30 2c 31 33 34 | 29 7b 5c 6c 69 6e 65 28 |(100,134|){\line(|
|00003b30| 30 2c 31 29 7b 38 7d 7d | 0d 0a 5c 70 75 74 28 32 |0,1){8}}|..\put(2|
|00003b40| 31 39 2c 31 33 38 29 7b | 5c 76 65 63 74 6f 72 28 |19,138){|\vector(|
|00003b50| 20 31 2c 30 29 7b 35 39 | 7d 7d 0d 0a 5c 70 75 74 | 1,0){59|}}..\put|
|00003b60| 28 32 37 38 2c 31 33 34 | 29 7b 5c 6c 69 6e 65 28 |(278,134|){\line(|
|00003b70| 30 2c 31 29 7b 38 7d 7d | 0d 0a 5c 70 75 74 28 31 |0,1){8}}|..\put(1|
|00003b80| 36 30 2c 31 33 35 29 7b | 7b 5c 74 74 20 45 78 70 |60,135){|{\tt Exp|
|00003b90| 69 72 65 41 66 74 65 72 | 7d 7d 0d 0a 25 0d 0a 5c |ireAfter|}}..%..\|
|00003ba0| 70 75 74 28 33 30 30 2c | 31 38 38 29 7b 5c 66 72 |put(300,|188){\fr|
|00003bb0| 61 6d 65 62 6f 78 28 38 | 30 2c 32 35 29 7b 4e 65 |amebox(8|0,25){Ne|
|00003bc0| 77 20 63 66 65 6e 67 69 | 6e 65 7d 7d 0d 0a 5c 70 |w cfengi|ne}}..\p|
|00003bd0| 75 74 28 32 30 30 2c 31 | 34 36 29 7b 5c 64 61 73 |ut(200,1|46){\das|
|00003be0| 68 62 6f 78 7b 33 7d 28 | 35 30 2c 32 35 29 7b 4c |hbox{3}(|50,25){L|
|00003bf0| 6f 63 6b 65 64 7d 7d 0d | 0a 5c 70 75 74 28 33 30 |ocked}}.|.\put(30|
|00003c00| 30 2c 31 30 34 29 7b 5c | 6d 61 6b 65 62 6f 78 28 |0,104){\|makebox(|
|00003c10| 33 30 2c 32 35 29 7b 4b | 69 6c 6c 65 64 7d 7d 0d |30,25){K|illed}}.|
|00003c20| 0a 5c 70 75 74 28 31 30 | 30 2c 31 30 34 29 7b 5c |.\put(10|0,104){\|
|00003c30| 66 72 61 6d 65 62 6f 78 | 28 32 33 30 2c 32 35 29 |framebox|(230,25)|
|00003c40| 7b 4c 6f 6e 67 20 72 75 | 6e 6e 69 6e 67 20 63 66 |{Long ru|nning cf|
|00003c50| 65 6e 67 69 6e 65 7d 7d | 0d 0a 5c 70 75 74 28 20 |engine}}|..\put( |
|00003c60| 35 32 2c 36 32 29 7b 5c | 64 61 73 68 62 6f 78 7b |52,62){\|dashbox{|
|00003c70| 33 7d 28 34 35 2c 32 35 | 29 7b 54 6f 6f 20 73 6f |3}(45,25|){Too so|
|00003c80| 6f 6e 7d 7d 0d 0a 5c 70 | 75 74 28 20 20 30 2c 32 |on}}..\p|ut( 0,2|
|00003c90| 30 29 7b 5c 66 72 61 6d | 65 62 6f 78 28 34 33 2c |0){\fram|ebox(43,|
|00003ca0| 32 35 29 7b 43 66 65 6e | 67 69 6e 65 7d 7d 0d 0a |25){Cfen|gine}}..|
|00003cb0| 25 0d 0a 5c 6d 75 6c 74 | 69 70 75 74 28 33 30 30 |%..\mult|iput(300|
|00003cc0| 2c 31 30 34 29 28 30 2c | 31 29 7b 32 35 7d 7b 5c |,104)(0,|1){25}{\|
|00003cd0| 6c 69 6e 65 28 30 2c 31 | 29 7b 30 2e 32 7d 7d 0d |line(0,1|){0.2}}.|
|00003ce0| 0a 5c 6d 75 6c 74 69 70 | 75 74 28 33 30 31 2c 31 |.\multip|ut(301,1|
|00003cf0| 30 34 29 28 30 2c 31 29 | 7b 32 35 7d 7b 5c 6c 69 |04)(0,1)|{25}{\li|
|00003d00| 6e 65 28 30 2c 31 29 7b | 30 2e 32 7d 7d 0d 0a 5c |ne(0,1){|0.2}}..\|
|00003d10| 6d 75 6c 74 69 70 75 74 | 28 33 30 32 2c 31 30 34 |multiput|(302,104|
|00003d20| 29 28 30 2c 31 29 7b 32 | 35 7d 7b 5c 6c 69 6e 65 |)(0,1){2|5}{\line|
|00003d30| 28 30 2c 31 29 7b 30 2e | 32 7d 7d 0d 0a 5c 6d 75 |(0,1){0.|2}}..\mu|
|00003d40| 6c 74 69 70 75 74 28 33 | 30 33 2c 31 30 34 29 28 |ltiput(3|03,104)(|
|00003d50| 30 2c 31 29 7b 32 35 7d | 7b 5c 6c 69 6e 65 28 30 |0,1){25}|{\line(0|
|00003d60| 2c 31 29 7b 30 2e 32 7d | 7d 0d 0a 5c 6d 75 6c 74 |,1){0.2}|}..\mult|
|00003d70| 69 70 75 74 28 33 30 34 | 2c 31 30 34 29 28 30 2c |iput(304|,104)(0,|
|00003d80| 31 29 7b 32 35 7d 7b 5c | 6c 69 6e 65 28 30 2c 31 |1){25}{\|line(0,1|
|00003d90| 29 7b 30 2e 32 7d 7d 0d | 0a 5c 6d 75 6c 74 69 70 |){0.2}}.|.\multip|
|00003da0| 75 74 28 33 30 35 2c 31 | 30 34 29 28 30 2c 31 29 |ut(305,1|04)(0,1)|
|00003db0| 7b 32 35 7d 7b 5c 6c 69 | 6e 65 28 30 2c 31 29 7b |{25}{\li|ne(0,1){|
|00003dc0| 30 2e 32 7d 7d 0d 0a 5c | 6d 75 6c 74 69 70 75 74 |0.2}}..\|multiput|
|00003dd0| 28 33 30 36 2c 31 30 34 | 29 28 30 2c 31 29 7b 32 |(306,104|)(0,1){2|
|00003de0| 35 7d 7b 5c 6c 69 6e 65 | 28 30 2c 31 29 7b 30 2e |5}{\line|(0,1){0.|
|00003df0| 32 7d 7d 0d 0a 5c 6d 75 | 6c 74 69 70 75 74 28 33 |2}}..\mu|ltiput(3|
|00003e00| 30 37 2c 31 30 34 29 28 | 30 2c 31 29 7b 32 35 7d |07,104)(|0,1){25}|
|00003e10| 7b 5c 6c 69 6e 65 28 30 | 2c 31 29 7b 30 2e 32 7d |{\line(0|,1){0.2}|
|00003e20| 7d 0d 0a 5c 6d 75 6c 74 | 69 70 75 74 28 33 30 38 |}..\mult|iput(308|
|00003e30| 2c 31 30 34 29 28 30 2c | 31 29 7b 32 35 7d 7b 5c |,104)(0,|1){25}{\|
|00003e40| 6c 69 6e 65 28 30 2c 31 | 29 7b 30 2e 32 7d 7d 0d |line(0,1|){0.2}}.|
|00003e50| 0a 5c 6d 75 6c 74 69 70 | 75 74 28 33 30 39 2c 31 |.\multip|ut(309,1|
|00003e60| 30 34 29 28 30 2c 31 29 | 7b 32 35 7d 7b 5c 6c 69 |04)(0,1)|{25}{\li|
|00003e70| 6e 65 28 30 2c 31 29 7b | 30 2e 32 7d 7d 0d 0a 5c |ne(0,1){|0.2}}..\|
|00003e80| 6d 75 6c 74 69 70 75 74 | 28 33 31 30 2c 31 30 34 |multiput|(310,104|
|00003e90| 29 28 30 2c 31 29 7b 32 | 35 7d 7b 5c 6c 69 6e 65 |)(0,1){2|5}{\line|
|00003ea0| 28 30 2c 31 29 7b 30 2e | 32 7d 7d 0d 0a 5c 6d 75 |(0,1){0.|2}}..\mu|
|00003eb0| 6c 74 69 70 75 74 28 33 | 31 31 2c 31 30 34 29 28 |ltiput(3|11,104)(|
|00003ec0| 30 2c 31 29 7b 32 35 7d | 7b 5c 6c 69 6e 65 28 30 |0,1){25}|{\line(0|
|00003ed0| 2c 31 29 7b 30 2e 32 7d | 7d 0d 0a 5c 6d 75 6c 74 |,1){0.2}|}..\mult|
|00003ee0| 69 70 75 74 28 33 31 32 | 2c 31 30 34 29 28 30 2c |iput(312|,104)(0,|
|00003ef0| 31 29 7b 32 35 7d 7b 5c | 6c 69 6e 65 28 30 2c 31 |1){25}{\|line(0,1|
|00003f00| 29 7b 30 2e 32 7d 7d 0d | 0a 5c 6d 75 6c 74 69 70 |){0.2}}.|.\multip|
|00003f10| 75 74 28 33 31 33 2c 31 | 30 34 29 28 30 2c 31 29 |ut(313,1|04)(0,1)|
|00003f20| 7b 32 35 7d 7b 5c 6c 69 | 6e 65 28 30 2c 31 29 7b |{25}{\li|ne(0,1){|
|00003f30| 30 2e 32 7d 7d 0d 0a 5c | 6d 75 6c 74 69 70 75 74 |0.2}}..\|multiput|
|00003f40| 28 33 31 34 2c 31 30 34 | 29 28 30 2c 31 29 7b 32 |(314,104|)(0,1){2|
|00003f50| 35 7d 7b 5c 6c 69 6e 65 | 28 30 2c 31 29 7b 30 2e |5}{\line|(0,1){0.|
|00003f60| 32 7d 7d 0d 0a 5c 6d 75 | 6c 74 69 70 75 74 28 33 |2}}..\mu|ltiput(3|
|00003f70| 31 35 2c 31 30 34 29 28 | 30 2c 31 29 7b 32 35 7d |15,104)(|0,1){25}|
|00003f80| 7b 5c 6c 69 6e 65 28 30 | 2c 31 29 7b 30 2e 32 7d |{\line(0|,1){0.2}|
|00003f90| 7d 0d 0a 5c 6d 75 6c 74 | 69 70 75 74 28 33 31 36 |}..\mult|iput(316|
|00003fa0| 2c 31 30 34 29 28 30 2c | 31 29 7b 32 35 7d 7b 5c |,104)(0,|1){25}{\|
|00003fb0| 6c 69 6e 65 28 30 2c 31 | 29 7b 30 2e 32 7d 7d 0d |line(0,1|){0.2}}.|
|00003fc0| 0a 5c 6d 75 6c 74 69 70 | 75 74 28 33 31 37 2c 31 |.\multip|ut(317,1|
|00003fd0| 30 34 29 28 30 2c 31 29 | 7b 32 35 7d 7b 5c 6c 69 |04)(0,1)|{25}{\li|
|00003fe0| 6e 65 28 30 2c 31 29 7b | 30 2e 32 7d 7d 0d 0a 5c |ne(0,1){|0.2}}..\|
|00003ff0| 6d 75 6c 74 69 70 75 74 | 28 33 31 38 2c 31 30 34 |multiput|(318,104|
|00004000| 29 28 30 2c 31 29 7b 32 | 35 7d 7b 5c 6c 69 6e 65 |)(0,1){2|5}{\line|
|00004010| 28 30 2c 31 29 7b 30 2e | 32 7d 7d 0d 0a 5c 6d 75 |(0,1){0.|2}}..\mu|
|00004020| 6c 74 69 70 75 74 28 33 | 31 39 2c 31 30 34 29 28 |ltiput(3|19,104)(|
|00004030| 30 2c 31 29 7b 32 35 7d | 7b 5c 6c 69 6e 65 28 30 |0,1){25}|{\line(0|
|00004040| 2c 31 29 7b 30 2e 32 7d | 7d 0d 0a 5c 6d 75 6c 74 |,1){0.2}|}..\mult|
|00004050| 69 70 75 74 28 33 32 30 | 2c 31 30 34 29 28 30 2c |iput(320|,104)(0,|
|00004060| 31 29 7b 32 35 7d 7b 5c | 6c 69 6e 65 28 30 2c 31 |1){25}{\|line(0,1|
|00004070| 29 7b 30 2e 32 7d 7d 0d | 0a 5c 6d 75 6c 74 69 70 |){0.2}}.|.\multip|
|00004080| 75 74 28 33 32 31 2c 31 | 30 34 29 28 30 2c 31 29 |ut(321,1|04)(0,1)|
|00004090| 7b 32 35 7d 7b 5c 6c 69 | 6e 65 28 30 2c 31 29 7b |{25}{\li|ne(0,1){|
|000040a0| 30 2e 32 7d 7d 0d 0a 5c | 6d 75 6c 74 69 70 75 74 |0.2}}..\|multiput|
|000040b0| 28 33 32 32 2c 31 30 34 | 29 28 30 2c 31 29 7b 32 |(322,104|)(0,1){2|
|000040c0| 35 7d 7b 5c 6c 69 6e 65 | 28 30 2c 31 29 7b 30 2e |5}{\line|(0,1){0.|
|000040d0| 32 7d 7d 0d 0a 5c 6d 75 | 6c 74 69 70 75 74 28 33 |2}}..\mu|ltiput(3|
|000040e0| 32 33 2c 31 30 34 29 28 | 30 2c 31 29 7b 32 35 7d |23,104)(|0,1){25}|
|000040f0| 7b 5c 6c 69 6e 65 28 30 | 2c 31 29 7b 30 2e 32 7d |{\line(0|,1){0.2}|
|00004100| 7d 0d 0a 5c 6d 75 6c 74 | 69 70 75 74 28 33 32 34 |}..\mult|iput(324|
|00004110| 2c 31 30 34 29 28 30 2c | 31 29 7b 32 35 7d 7b 5c |,104)(0,|1){25}{\|
|00004120| 6c 69 6e 65 28 30 2c 31 | 29 7b 30 2e 32 7d 7d 0d |line(0,1|){0.2}}.|
|00004130| 0a 5c 6d 75 6c 74 69 70 | 75 74 28 33 32 35 2c 31 |.\multip|ut(325,1|
|00004140| 30 34 29 28 30 2c 31 29 | 7b 32 35 7d 7b 5c 6c 69 |04)(0,1)|{25}{\li|
|00004150| 6e 65 28 30 2c 31 29 7b | 30 2e 32 7d 7d 0d 0a 5c |ne(0,1){|0.2}}..\|
|00004160| 6d 75 6c 74 69 70 75 74 | 28 33 32 36 2c 31 30 34 |multiput|(326,104|
|00004170| 29 28 30 2c 31 29 7b 32 | 35 7d 7b 5c 6c 69 6e 65 |)(0,1){2|5}{\line|
|00004180| 28 30 2c 31 29 7b 30 2e | 32 7d 7d 0d 0a 5c 6d 75 |(0,1){0.|2}}..\mu|
|00004190| 6c 74 69 70 75 74 28 33 | 32 37 2c 31 30 34 29 28 |ltiput(3|27,104)(|
|000041a0| 30 2c 31 29 7b 32 35 7d | 7b 5c 6c 69 6e 65 28 30 |0,1){25}|{\line(0|
|000041b0| 2c 31 29 7b 30 2e 32 7d | 7d 0d 0a 5c 6d 75 6c 74 |,1){0.2}|}..\mult|
|000041c0| 69 70 75 74 28 33 32 38 | 2c 31 30 34 29 28 30 2c |iput(328|,104)(0,|
|000041d0| 31 29 7b 32 35 7d 7b 5c | 6c 69 6e 65 28 30 2c 31 |1){25}{\|line(0,1|
|000041e0| 29 7b 30 2e 32 7d 7d 0d | 0a 5c 6d 75 6c 74 69 70 |){0.2}}.|.\multip|
|000041f0| 75 74 28 33 32 39 2c 31 | 30 34 29 28 30 2c 31 29 |ut(329,1|04)(0,1)|
|00004200| 7b 32 35 7d 7b 5c 6c 69 | 6e 65 28 30 2c 31 29 7b |{25}{\li|ne(0,1){|
|00004210| 30 2e 32 7d 7d 0d 0a 5c | 6d 75 6c 74 69 70 75 74 |0.2}}..\|multiput|
|00004220| 28 33 33 30 2c 31 30 34 | 29 28 30 2c 31 29 7b 32 |(330,104|)(0,1){2|
|00004230| 35 7d 7b 5c 6c 69 6e 65 | 28 30 2c 31 29 7b 30 2e |5}{\line|(0,1){0.|
|00004240| 32 7d 7d 0d 0a 5c 70 75 | 74 28 33 31 35 2c 31 38 |2}}..\pu|t(315,18|
|00004250| 38 29 7b 5c 76 65 63 74 | 6f 72 28 30 2c 2d 31 29 |8){\vect|or(0,-1)|
|00004260| 7b 35 39 7d 7d 0d 0a 5c | 65 6e 64 7b 70 69 63 74 |{59}}..\|end{pict|
|00004270| 75 72 65 7d 0d 0a 7d 0d | 0a 5c 6c 61 62 65 6c 7b |ure}..}.|.\label{|
|00004280| 75 67 68 7d 0d 0a 5c 63 | 61 70 74 69 6f 6e 7b 41 |ugh}..\c|aption{A|
|00004290| 20 73 63 68 65 6d 61 74 | 69 63 20 69 6c 6c 75 73 | schemat|ic illus|
|000042a0| 74 72 61 74 69 6f 6e 20 | 6f 66 20 74 68 65 20 62 |tration |of the b|
|000042b0| 65 68 61 76 69 6f 75 72 | 20 6f 66 20 6c 6f 63 6b |ehaviour| of lock|
|000042c0| 73 20 77 69 74 68 0d 0a | 72 65 73 70 65 63 74 20 |s with..|respect |
|000042d0| 74 6f 20 74 68 65 20 73 | 63 68 65 64 75 6c 69 6e |to the s|chedulin|
|000042e0| 67 20 69 6e 74 65 72 76 | 61 6c 20 24 5c 44 65 6c |g interv|al $\Del|
|000042f0| 74 61 20 74 24 20 61 6e | 64 20 74 68 65 20 70 61 |ta t$ an|d the pa|
|00004300| 72 61 6d 65 74 65 72 73 | 20 7b 5c 74 74 0d 0a 49 |rameters| {\tt..I|
|00004310| 66 45 6c 61 70 73 65 64 | 7d 20 61 6e 64 20 7b 5c |fElapsed|} and {\|
|00004320| 74 74 20 45 78 70 69 72 | 65 41 66 74 65 72 7d 2e |tt Expir|eAfter}.|
|00004330| 7d 0d 0a 5c 65 6e 64 7b | 66 69 67 75 72 65 2a 7d |}..\end{|figure*}|
|00004340| 0d 0a 0d 0a 41 20 72 65 | 63 6f 72 64 20 6f 66 20 |....A re|cord of |
|00004350| 74 68 65 73 65 20 6c 6f | 63 6b 20 74 72 61 6e 73 |these lo|ck trans|
|00004360| 61 63 74 69 6f 6e 73 20 | 69 73 20 6b 65 70 74 20 |actions |is kept |
|00004370| 66 6f 72 20 73 75 62 73 | 65 71 75 65 6e 74 20 61 |for subs|equent a|
|00004380| 6e 61 6c 79 73 69 73 20 | 69 66 0d 0a 72 65 71 75 |nalysis |if..requ|
|00004390| 69 72 65 64 2e 20 54 68 | 69 73 20 69 6e 64 69 63 |ired. Th|is indic|
|000043a0| 61 74 65 73 20 77 68 65 | 6e 20 61 6e 64 20 68 6f |ates whe|n and ho|
|000043b0| 77 20 6c 6f 63 6b 73 20 | 77 65 72 65 20 63 72 65 |w locks |were cre|
|000043c0| 61 74 65 64 20 61 6e 64 | 20 72 65 6d 6f 76 65 64 |ated and| removed|
|000043d0| 2c 0d 0a 74 68 65 72 65 | 62 79 20 61 6c 6c 6f 77 |,..there|by allow|
|000043e0| 69 6e 67 20 70 72 6f 62 | 6c 65 6d 20 63 61 73 65 |ing prob|lem case|
|000043f0| 73 2c 20 73 75 63 68 20 | 61 73 20 6c 6f 63 6b 73 |s, such |as locks|
|00004400| 20 77 68 69 63 68 20 61 | 6c 77 61 79 73 20 6e 65 | which a|lways ne|
|00004410| 65 64 20 74 6f 20 62 65 | 0d 0a 72 65 6d 6f 76 65 |ed to be|..remove|
|00004420| 64 20 66 6f 72 63 69 62 | 6c 79 2c 20 74 6f 20 62 |d forcib|ly, to b|
|00004430| 65 20 74 72 61 63 65 64 | 2e 0d 0a 0d 0a 5c 62 65 |e traced|.....\be|
|00004440| 67 69 6e 7b 66 69 67 75 | 72 65 2a 7d 0d 0a 5c 62 |gin{figu|re*}..\b|
|00004450| 65 67 69 6e 7b 76 65 72 | 62 61 74 69 6d 7d 0d 0a |egin{ver|batim}..|
|00004460| 20 20 20 20 20 20 47 65 | 74 4c 6f 63 6b 28 6f 70 | Ge|tLock(op|
|00004470| 65 72 61 74 6f 72 2c 6f | 70 65 72 61 6e 64 2c 69 |erator,o|perand,i|
|00004480| 66 65 6c 61 70 73 65 64 | 2c 65 78 70 69 72 65 61 |felapsed|,expirea|
|00004490| 66 74 65 72 2c 68 6f 73 | 74 2c 6e 6f 77 29 0d 0a |fter,hos|t,now)..|
|000044a0| 20 20 20 20 20 20 7b 0d | 0a 20 20 20 20 20 20 73 | {.|. s|
|000044b0| 70 72 69 6e 74 66 28 4c | 4f 47 2c 22 25 73 2f 70 |printf(L|OG,"%s/p|
|000044c0| 72 6f 67 72 61 6d 2e 25 | 73 2e 72 75 6e 6c 6f 67 |rogram.%|s.runlog|
|000044d0| 22 2c 4c 4f 47 44 49 52 | 2c 68 6f 73 74 29 3b 0d |",LOGDIR|,host);.|
|000044e0| 0a 20 20 20 20 20 20 73 | 70 72 69 6e 74 66 28 4c |. s|printf(L|
|000044f0| 4f 43 4b 2c 22 25 73 2f | 6c 6f 63 6b 2e 25 73 2e |OCK,"%s/|lock.%s.|
|00004500| 25 73 2e 25 73 22 2c 4c | 4f 43 4b 44 49 52 2c 68 |%s.%s",L|OCKDIR,h|
|00004510| 6f 73 74 2c 6f 70 65 72 | 61 74 6f 72 2c 6f 70 65 |ost,oper|ator,ope|
|00004520| 72 61 6e 64 29 3b 0d 0a | 20 20 20 20 20 20 73 70 |rand);..| sp|
|00004530| 72 69 6e 74 66 28 4c 41 | 53 54 2c 22 25 73 2f 6c |rintf(LA|ST,"%s/l|
|00004540| 61 73 74 2e 25 73 2e 25 | 73 2e 25 73 22 2c 4c 4f |ast.%s.%|s.%s",LO|
|00004550| 43 4b 44 49 52 2c 68 6f | 73 74 2c 6f 70 65 72 61 |CKDIR,ho|st,opera|
|00004560| 74 6f 72 2c 6f 70 65 72 | 61 6e 64 29 3b 0d 0a 0d |tor,oper|and);...|
|00004570| 0a 20 20 20 20 20 20 6c | 61 73 74 63 6f 6d 70 6c |. l|astcompl|
|00004580| 65 74 65 64 20 3d 20 47 | 65 74 4c 61 73 74 4c 6f |eted = G|etLastLo|
|00004590| 63 6b 28 29 3b 20 20 20 | 20 20 20 20 2f 2a 20 43 |ck(); | /* C|
|000045a0| 68 65 63 6b 20 66 6f 72 | 20 6e 6f 6e 2d 65 78 69 |heck for| non-exi|
|000045b0| 73 74 65 6e 74 20 70 72 | 6f 63 65 73 73 20 2a 2f |stent pr|ocess */|
|000045c0| 0d 0a 20 20 20 20 20 20 | 65 6c 61 70 73 65 64 74 |.. |elapsedt|
|000045d0| 69 6d 65 20 3d 20 28 6e | 6f 77 2d 6c 61 73 74 63 |ime = (n|ow-lastc|
|000045e0| 6f 6d 70 6c 65 74 65 64 | 29 20 2f 20 36 30 3b 0d |ompleted|) / 60;.|
|000045f0| 0a 0d 0a 20 20 20 20 20 | 20 69 66 20 28 65 6c 61 |... | if (ela|
|00004600| 70 73 65 64 74 69 6d 65 | 20 3c 20 69 66 65 6c 61 |psedtime| < ifela|
|00004610| 70 73 65 64 29 0d 0a 20 | 20 20 20 20 20 20 20 20 |psed).. | |
|00004620| 7b 0d 0a 20 20 20 20 20 | 20 20 20 20 72 65 74 75 |{.. | retu|
|00004630| 72 6e 20 66 61 6c 73 65 | 3b 0d 0a 20 20 20 20 20 |rn false|;.. |
|00004640| 20 20 20 20 7d 0d 0a 0d | 0a 20 20 20 20 20 20 6c | }...|. l|
|00004650| 61 73 74 63 6f 6d 70 6c | 65 74 65 64 20 3d 20 43 |astcompl|eted = C|
|00004660| 68 65 63 6b 4f 6c 64 4c | 6f 63 6b 28 29 3b 20 20 |heckOldL|ock(); |
|00004670| 20 20 20 20 20 2f 2a 20 | 43 68 65 63 6b 20 66 6f | /* |Check fo|
|00004680| 72 20 65 78 69 73 74 69 | 6e 67 20 70 72 6f 63 65 |r existi|ng proce|
|00004690| 73 73 20 2a 2f 0d 0a 20 | 20 20 20 20 20 65 6c 61 |ss */.. | ela|
|000046a0| 70 73 65 64 74 69 6d 65 | 20 3d 20 28 6e 6f 77 2d |psedtime| = (now-|
|000046b0| 6c 61 73 74 63 6f 6d 70 | 6c 65 74 65 64 29 20 2f |lastcomp|leted) /|
|000046c0| 20 36 30 3b 0d 0a 0d 0a | 20 20 20 20 20 20 69 66 | 60;....| if|
|000046d0| 20 28 6c 61 73 74 63 6f | 6d 70 6c 65 74 65 64 20 | (lastco|mpleted |
|000046e0| 21 3d 20 30 29 0d 0a 20 | 20 20 20 20 20 20 20 20 |!= 0).. | |
|000046f0| 7b 0d 0a 20 20 20 20 20 | 20 20 20 20 69 66 20 28 |{.. | if (|
|00004700| 65 6c 61 70 73 65 64 74 | 69 6d 65 20 3e 3d 20 65 |elapsedt|ime >= e|
|00004710| 78 70 69 72 65 61 66 74 | 65 72 29 0d 0a 20 20 20 |xpireaft|er).. |
|00004720| 20 20 20 20 20 20 20 20 | 20 7b 0d 0a 20 20 20 20 | | {.. |
|00004730| 20 20 20 20 20 20 20 20 | 70 69 64 20 3d 20 47 65 | |pid = Ge|
|00004740| 74 4c 6f 63 6b 50 69 64 | 28 29 3b 20 20 20 20 20 |tLockPid|(); |
|00004750| 20 20 20 20 20 20 20 20 | 2f 2a 20 4c 6f 63 6b 20 | |/* Lock |
|00004760| 65 78 70 69 72 65 64 20 | 2a 2f 0d 0a 20 20 20 20 |expired |*/.. |
|00004770| 20 20 20 20 20 20 20 20 | 4b 69 6c 6c 43 61 72 65 | |KillCare|
|00004780| 66 75 6c 6c 79 28 70 69 | 64 29 3b 0d 0a 20 20 20 |fully(pi|d);.. |
|00004790| 20 20 20 20 20 20 20 20 | 20 75 6e 6c 69 6e 6b 28 | | unlink(|
|000047a0| 4c 4f 43 4b 29 3b 0d 0a | 20 20 20 20 20 20 20 20 |LOCK);..| |
|000047b0| 20 20 20 20 7d 0d 0a 20 | 20 20 20 20 20 20 20 20 | }.. | |
|000047c0| 65 6c 73 65 0d 0a 20 20 | 20 20 20 20 20 20 20 20 |else.. | |
|000047d0| 20 20 7b 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 | {.. | |
|000047e0| 20 72 65 74 75 72 6e 20 | 66 61 6c 73 65 3b 20 20 | return |false; |
|000047f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004800| 20 2f 2a 20 41 6c 72 65 | 61 64 79 20 72 75 6e 6e | /* Alre|ady runn|
|00004810| 69 6e 67 20 2a 2f 0d 0a | 20 20 20 20 20 20 20 20 |ing */..| |
|00004820| 20 20 20 20 7d 0d 0a 20 | 20 20 20 20 20 20 20 7d | }.. | }|
|00004830| 0d 0a 0d 0a 20 20 20 20 | 20 20 53 65 74 4c 6f 63 |.... | SetLoc|
|00004840| 6b 28 29 3b 0d 0a 20 20 | 20 20 20 20 72 65 74 75 |k();.. | retu|
|00004850| 72 6e 20 74 72 75 65 3b | 0d 0a 20 20 20 20 20 20 |rn true;|.. |
|00004860| 7d 0d 0a 5c 65 6e 64 7b | 76 65 72 62 61 74 69 6d |}..\end{|verbatim|
|00004870| 7d 0d 0a 5c 63 61 70 74 | 69 6f 6e 7b 41 20 73 63 |}..\capt|ion{A sc|
|00004880| 68 65 6d 61 74 69 63 20 | 61 6c 67 6f 72 69 74 68 |hematic |algorith|
|00004890| 6d 20 66 6f 72 20 69 6d | 70 6c 65 6d 65 6e 74 69 |m for im|plementi|
|000048a0| 6e 67 20 74 68 65 20 6c | 6f 63 6b 69 6e 67 0d 0a |ng the l|ocking..|
|000048b0| 70 6f 6c 69 63 79 2e 20 | 54 68 65 20 66 75 6e 63 |policy. |The func|
|000048c0| 74 69 6f 6e 20 63 61 6c | 6c 20 7b 5c 74 74 20 47 |tion cal|l {\tt G|
|000048d0| 65 74 4c 6f 63 6b 28 29 | 7d 20 74 61 6b 65 73 20 |etLock()|} takes |
|000048e0| 61 72 67 75 6d 65 6e 74 | 73 20 77 68 69 63 68 20 |argument|s which |
|000048f0| 61 72 65 0d 0a 75 73 65 | 64 20 74 6f 20 62 75 69 |are..use|d to bui|
|00004900| 6c 64 20 61 20 75 6e 69 | 71 75 65 20 6e 61 6d 65 |ld a uni|que name|
|00004910| 2e 20 4f 70 65 72 61 74 | 6f 72 20 61 6e 64 20 6f |. Operat|or and o|
|00004920| 70 65 72 61 6e 64 20 70 | 65 72 74 61 69 6e 20 74 |perand p|ertain t|
|00004930| 6f 20 74 68 65 20 61 74 | 6f 6d 0d 0a 77 68 69 63 |o the at|om..whic|
|00004940| 68 20 69 73 20 74 6f 20 | 62 65 20 6c 6f 63 6b 65 |h is to |be locke|
|00004950| 64 2e 20 54 68 65 20 65 | 78 70 69 72 79 20 74 69 |d. The e|xpiry ti|
|00004960| 6d 65 20 61 6e 64 20 65 | 6c 61 70 73 65 64 20 74 |me and e|lapsed t|
|00004970| 69 6d 65 20 6c 69 6d 69 | 74 73 20 61 72 65 0d 0a |ime limi|ts are..|
|00004980| 74 69 6d 65 73 20 69 6e | 20 6d 69 6e 75 74 65 73 |times in| minutes|
|00004990| 2c 20 61 6e 64 20 74 68 | 65 20 7b 5c 74 74 20 6e |, and th|e {\tt n|
|000049a0| 6f 77 7d 20 70 61 72 61 | 6d 65 74 65 72 20 69 73 |ow} para|meter is|
|000049b0| 20 74 68 65 20 73 79 73 | 74 65 6d 20 63 6c 6f 63 | the sys|tem cloc|
|000049c0| 6b 0d 0a 76 61 6c 75 65 | 20 66 6f 72 20 74 68 65 |k..value| for the|
|000049d0| 20 74 69 6d 65 20 61 74 | 20 77 68 69 63 68 20 74 | time at| which t|
|000049e0| 68 65 20 6c 6f 63 6b 20 | 69 73 20 63 72 65 61 74 |he lock |is creat|
|000049f0| 65 64 2e 20 54 68 65 20 | 66 75 6e 63 74 69 6f 6e |ed. The |function|
|00004a00| 20 7b 5c 74 74 0d 0a 47 | 65 74 4c 61 73 74 4c 6f | {\tt..G|etLastLo|
|00004a10| 63 6b 28 29 7d 20 63 72 | 65 61 74 65 73 20 74 68 |ck()} cr|eates th|
|00004a20| 65 20 61 6e 74 69 2d 73 | 70 61 6d 6d 69 6e 67 20 |e anti-s|pamming |
|00004a30| 60 6c 61 73 74 27 20 6c | 6f 63 6b 20 69 66 20 69 |`last' l|ock if i|
|00004a40| 74 20 64 6f 65 73 20 6e | 6f 74 0d 0a 70 72 65 76 |t does n|ot..prev|
|00004a50| 69 6f 75 73 6c 79 20 65 | 78 69 73 74 2e 20 54 68 |iously e|xist. Th|
|00004a60| 69 73 20 69 73 20 69 6d | 70 6f 72 74 61 6e 74 20 |is is im|portant |
|00004a70| 66 6f 72 20 74 68 65 6f | 72 65 74 69 63 61 6c 20 |for theo|retical |
|00004a80| 64 65 61 64 6c 6f 63 6b | 0d 0a 61 76 6f 69 64 61 |deadlock|..avoida|
|00004a90| 6e 63 65 2e 7d 0d 0a 5c | 65 6e 64 7b 66 69 67 75 |nce.}..\|end{figu|
|00004aa0| 72 65 2a 7d 0d 0a 0d 0a | 54 6f 20 6d 61 6b 65 20 |re*}....|To make |
|00004ab0| 74 68 65 20 6c 6f 63 6b | 69 6e 67 20 62 65 68 61 |the lock|ing beha|
|00004ac0| 76 69 6f 75 72 20 75 73 | 65 72 2d 63 6f 6e 66 69 |viour us|er-confi|
|00004ad0| 67 75 72 61 62 6c 65 20 | 77 65 20 69 6e 74 72 6f |gurable |we intro|
|00004ae0| 64 75 63 65 20 74 77 6f | 0d 0a 70 61 72 61 6d 65 |duce two|..parame|
|00004af0| 74 65 72 73 20 63 61 6c | 6c 65 64 20 7b 5c 74 74 |ters cal|led {\tt|
|00004b00| 20 45 78 70 69 72 65 41 | 66 74 65 72 7d 20 61 6e | ExpireA|fter} an|
|00004b10| 64 20 7b 5c 74 74 20 49 | 66 45 6c 61 70 73 65 64 |d {\tt I|fElapsed|
|00004b20| 7d 2c 20 77 68 69 63 68 | 20 68 61 76 65 0d 0a 76 |}, which| have..v|
|00004b30| 61 6c 75 65 73 20 69 6e | 20 6d 69 6e 75 74 65 73 |alues in| minutes|
|00004b40| 2e 20 53 65 65 20 66 69 | 67 75 72 65 20 5c 72 65 |. See fi|gure \re|
|00004b50| 66 7b 75 67 68 7d 2e 20 | 7b 5c 74 74 20 45 78 70 |f{ugh}. |{\tt Exp|
|00004b60| 69 72 65 41 66 74 65 72 | 7d 20 64 65 73 63 72 69 |ireAfter|} descri|
|00004b70| 62 65 73 0d 0a 74 68 65 | 20 6e 75 6d 62 65 72 20 |bes..the| number |
|00004b80| 6f 66 20 6d 69 6e 75 74 | 65 73 20 61 66 74 65 72 |of minut|es after|
|00004b90| 20 63 72 65 61 74 69 6f | 6e 20 61 74 20 77 68 69 | creatio|n at whi|
|00004ba0| 63 68 20 61 20 6c 6f 63 | 6b 20 73 68 6f 75 6c 64 |ch a loc|k should|
|00004bb0| 20 65 78 70 69 72 65 2e | 20 49 74 0d 0a 69 73 20 | expire.| It..is |
|00004bc0| 6d 65 61 73 75 72 65 64 | 20 66 72 6f 6d 20 74 68 |measured| from th|
|00004bd0| 65 20 63 72 65 61 74 69 | 6f 6e 20 74 69 6d 65 2d |e creati|on time-|
|00004be0| 73 74 61 6d 70 20 6f 6e | 20 74 68 65 20 61 63 74 |stamp on| the act|
|00004bf0| 69 76 65 20 6c 6f 63 6b | 20 74 6f 20 74 68 65 0d |ive lock| to the.|
|00004c00| 0a 63 75 72 72 65 6e 74 | 20 76 61 6c 75 65 20 6f |.current| value o|
|00004c10| 66 20 74 68 65 20 73 79 | 73 74 65 6d 20 63 6c 6f |f the sy|stem clo|
|00004c20| 63 6b 2e 20 20 7b 5c 74 | 74 20 49 66 45 6c 61 70 |ck. {\t|t IfElap|
|00004c30| 73 65 64 7d 20 64 65 73 | 63 72 69 62 65 73 20 74 |sed} des|cribes t|
|00004c40| 68 65 0d 0a 6e 75 6d 62 | 65 72 20 6f 66 20 6d 69 |he..numb|er of mi|
|00004c50| 6e 75 74 65 73 20 61 66 | 74 65 72 20 77 68 69 63 |nutes af|ter whic|
|00004c60| 68 20 69 74 20 62 65 63 | 6f 6d 65 73 20 61 63 63 |h it bec|omes acc|
|00004c70| 65 70 74 61 62 6c 65 20 | 74 6f 20 65 78 65 63 75 |eptable |to execu|
|00004c80| 74 65 20 74 68 65 0d 0a | 73 61 6d 65 20 61 74 6f |te the..|same ato|
|00004c90| 6d 20 61 67 61 69 6e 2e | 20 49 74 20 69 73 20 6d |m again.| It is m|
|00004ca0| 65 61 73 75 72 65 64 20 | 66 72 6f 6d 20 74 68 65 |easured |from the|
|00004cb0| 20 6d 6f 64 69 66 69 63 | 61 74 69 6f 6e 20 74 69 | modific|ation ti|
|00004cc0| 6d 65 20 73 74 61 6d 70 | 20 6f 66 0d 0a 74 68 65 |me stamp| of..the|
|00004cd0| 20 61 6e 74 69 2d 73 70 | 61 6d 6d 69 6e 67 20 6c | anti-sp|amming l|
|00004ce0| 6f 63 6b 20 74 6f 20 74 | 68 65 20 63 75 72 72 65 |ock to t|he curre|
|00004cf0| 6e 74 20 76 61 6c 75 65 | 20 6f 66 20 74 68 65 20 |nt value| of the |
|00004d00| 73 79 73 74 65 6d 20 63 | 6c 6f 63 6b 2e 0d 0a 0d |system c|lock....|
|00004d10| 0a 57 65 20 63 68 6f 6f | 73 65 20 74 6f 20 72 65 |.We choo|se to re|
|00004d20| 61 64 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 74 |ad the c|urrent t|
|00004d30| 69 6d 65 20 61 73 20 61 | 20 70 61 72 61 6d 65 74 |ime as a| paramet|
|00004d40| 65 72 20 74 6f 20 7b 5c | 74 74 20 47 65 74 4c 6f |er to {\|tt GetLo|
|00004d50| 63 6b 28 29 7d 2c 0d 0a | 72 61 74 68 65 72 20 74 |ck()},..|rather t|
|00004d60| 68 61 6e 20 72 65 61 64 | 69 6e 67 20 69 74 20 64 |han read|ing it d|
|00004d70| 69 72 65 63 74 6c 79 20 | 69 6e 20 74 68 65 20 6c |irectly |in the l|
|00004d80| 6f 63 6b 69 6e 67 20 66 | 75 6e 63 74 69 6f 6e 2c |ocking f|unction,|
|00004d90| 20 66 6f 72 20 74 68 65 | 0d 0a 66 6f 6c 6c 6f 77 | for the|..follow|
|00004da0| 69 6e 67 20 72 65 61 73 | 6f 6e 2e 20 54 68 65 20 |ing reas|on. The |
|00004db0| 6d 6f 73 74 20 63 6f 72 | 72 65 63 74 20 74 69 6d |most cor|rect tim|
|00004dc0| 65 20 74 6f 20 75 73 65 | 20 68 65 72 65 20 63 6f |e to use| here co|
|00004dd0| 75 6c 64 20 62 65 20 63 | 6f 6e 73 74 72 75 65 64 |uld be c|onstrued|
|00004de0| 0d 0a 69 6e 20 6f 6e 65 | 20 6f 66 20 74 77 6f 20 |..in one| of two |
|00004df0| 77 61 79 73 3a 20 69 74 | 20 63 6f 75 6c 64 20 62 |ways: it| could b|
|00004e00| 65 20 74 61 6b 65 6e 20 | 61 73 20 62 65 69 6e 67 |e taken |as being|
|00004e10| 20 74 68 65 20 74 69 6d | 65 20 61 74 20 77 68 69 | the tim|e at whi|
|00004e20| 63 68 20 74 68 65 0d 0a | 70 72 6f 67 72 61 6d 20 |ch the..|program |
|00004e30| 77 61 73 20 73 74 61 72 | 74 65 64 2c 20 6f 72 20 |was star|ted, or |
|00004e40| 61 73 20 74 68 65 20 65 | 78 61 63 74 20 74 69 6d |as the e|xact tim|
|00004e50| 65 20 61 74 20 77 68 69 | 63 68 20 74 68 65 20 6c |e at whi|ch the l|
|00004e60| 6f 63 6b 20 63 72 65 61 | 74 69 6f 6e 0d 0a 74 61 |ock crea|tion..ta|
|00004e70| 6b 65 73 20 70 6c 61 63 | 65 2e 20 54 68 65 20 64 |kes plac|e. The d|
|00004e80| 69 66 66 65 72 65 6e 63 | 65 20 62 65 74 77 65 65 |ifferenc|e betwee|
|00004e90| 6e 20 74 68 65 73 65 20 | 74 69 6d 65 73 20 63 6f |n these |times co|
|00004ea0| 75 6c 64 20 64 69 66 66 | 65 72 20 62 79 0d 0a 73 |uld diff|er by..s|
|00004eb0| 65 63 6f 6e 64 73 2c 20 | 6d 69 6e 75 74 65 73 20 |econds, |minutes |
|00004ec0| 6f 72 20 68 6f 75 72 73 | 20 64 65 70 65 6e 64 69 |or hours| dependi|
|00004ed0| 6e 67 20 6f 6e 20 74 68 | 65 20 6e 61 74 75 72 65 |ng on th|e nature|
|00004ee0| 20 6f 66 20 74 68 65 20 | 6a 6f 62 20 62 65 69 6e | of the |job bein|
|00004ef0| 67 0d 0a 6c 6f 63 6b 65 | 64 2e 20 20 42 79 20 75 |g..locke|d. By u|
|00004f00| 73 69 6e 67 20 74 68 65 | 20 74 69 6d 65 20 61 74 |sing the| time at|
|00004f10| 20 77 68 69 63 68 20 74 | 68 65 20 70 72 6f 67 72 | which t|he progr|
|00004f20| 61 6d 20 77 61 73 20 73 | 74 61 72 74 65 64 20 66 |am was s|tarted f|
|00004f30| 6f 72 20 61 6c 6c 0d 0a | 6c 6f 63 6b 73 20 74 68 |or all..|locks th|
|00004f40| 72 6f 75 67 68 6f 75 74 | 20 74 68 65 20 70 72 6f |roughout| the pro|
|00004f50| 67 72 61 6d 2c 20 6f 6e | 65 20 65 66 66 65 63 74 |gram, on|e effect|
|00004f60| 69 76 65 6c 79 20 74 72 | 65 61 74 73 20 61 20 60 |ively tr|eats a `|
|00004f70| 70 61 73 73 27 20 6f 66 | 20 74 68 65 0d 0a 70 72 |pass' of| the..pr|
|00004f80| 6f 67 72 61 6d 20 61 73 | 20 61 20 63 6f 68 65 73 |ogram as| a cohes|
|00004f90| 69 76 65 20 65 6e 74 69 | 74 79 3a 20 69 66 20 6f |ive enti|ty: if o|
|00004fa0| 6e 65 20 6c 6f 63 6b 20 | 65 78 70 69 72 65 73 20 |ne lock |expires |
|00004fb0| 66 6f 72 20 61 20 67 69 | 76 65 6e 20 76 61 6c 75 |for a gi|ven valu|
|00004fc0| 65 20 6f 66 0d 0a 7b 5c | 74 74 20 45 78 70 69 72 |e of..{\|tt Expir|
|00004fd0| 65 41 66 74 65 72 7d 2c | 20 74 68 65 79 20 61 6c |eAfter},| they al|
|00004fe0| 6c 20 65 78 70 69 72 65 | 2e 20 41 20 63 65 72 74 |l expire|. A cert|
|00004ff0| 61 69 6e 20 6f 72 64 65 | 72 69 6e 67 20 6f 66 20 |ain orde|ring of |
|00005000| 61 74 6f 6d 73 20 63 61 | 6e 20 62 65 0d 0a 70 72 |atoms ca|n be..pr|
|00005010| 65 73 65 72 76 65 64 2e | 20 49 66 2c 20 6f 6e 20 |eserved.| If, on |
|00005020| 74 68 65 20 6f 74 68 65 | 72 20 68 61 6e 64 2c 20 |the othe|r hand, |
|00005030| 6f 6e 65 20 61 6c 77 61 | 79 73 20 72 65 61 64 73 |one alwa|ys reads|
|00005040| 20 74 68 65 20 70 72 65 | 73 65 6e 74 20 76 61 6c | the pre|sent val|
|00005050| 75 65 0d 0a 6f 66 20 74 | 68 65 20 73 79 73 74 65 |ue..of t|he syste|
|00005060| 6d 20 63 6c 6f 63 6b 20 | 64 69 72 65 63 74 6c 79 |m clock |directly|
|00005070| 2c 20 74 68 65 20 6c 6f | 63 6b 69 6e 67 20 6d 65 |, the lo|cking me|
|00005080| 63 68 61 6e 69 73 6d 20 | 62 65 63 6f 6d 65 73 20 |chanism |becomes |
|00005090| 73 65 6e 73 69 74 69 76 | 65 0d 0a 74 6f 20 74 68 |sensitiv|e..to th|
|000050a0| 65 20 6c 65 6e 67 74 68 | 20 6f 66 20 74 69 6d 65 |e length| of time|
|000050b0| 20 69 74 20 68 61 73 20 | 74 61 6b 65 6e 20 74 6f | it has |taken to|
|000050c0| 20 65 78 65 63 75 74 65 | 20 74 68 65 20 64 69 66 | execute| the dif|
|000050d0| 66 65 72 65 6e 74 20 70 | 61 72 74 73 20 6f 66 0d |ferent p|arts of.|
|000050e0| 0a 74 68 65 20 70 72 6f | 67 72 61 6d 2e 20 42 6f |.the pro|gram. Bo|
|000050f0| 74 68 20 70 6f 6c 69 63 | 69 65 73 20 6d 69 67 68 |th polic|ies migh|
|00005100| 74 20 62 65 20 64 65 73 | 69 72 61 62 6c 65 20 69 |t be des|irable i|
|00005110| 6e 20 64 69 66 66 65 72 | 65 6e 74 20 73 69 74 75 |n differ|ent situ|
|00005120| 61 74 69 6f 6e 73 2c 0d | 0a 73 6f 20 77 65 20 64 |ations,.|.so we d|
|00005130| 6f 20 6e 6f 74 20 73 65 | 65 20 66 69 74 20 74 6f |o not se|e fit to|
|00005140| 20 69 6d 70 6f 73 65 20 | 61 6e 79 20 70 61 72 74 | impose |any part|
|00005150| 69 63 75 6c 61 72 20 72 | 65 73 74 72 69 63 74 69 |icular r|estricti|
|00005160| 6f 6e 20 6f 6e 20 74 68 | 69 73 2e 0d 0a 0d 0a 57 |on on th|is.....W|
|00005170| 68 65 6e 20 61 20 6c 6f | 63 6b 20 68 61 73 20 65 |hen a lo|ck has e|
|00005180| 78 70 69 72 65 64 2c 20 | 77 65 20 74 72 79 20 74 |xpired, |we try t|
|00005190| 6f 20 6b 69 6c 6c 20 74 | 68 65 20 6f 77 6e 65 72 |o kill t|he owner|
|000051a0| 20 70 72 6f 63 65 73 73 | 20 6f 66 20 74 68 65 0d | process| of the.|
|000051b0| 0a 65 78 70 69 72 65 64 | 20 6c 6f 63 6b 2e 20 20 |.expired| lock. |
|000051c0| 54 68 65 20 70 72 6f 63 | 65 73 73 20 49 44 20 6f |The proc|ess ID o|
|000051d0| 66 20 74 68 65 20 65 78 | 70 69 72 65 64 20 70 72 |f the ex|pired pr|
|000051e0| 6f 63 65 73 73 20 69 73 | 20 72 65 61 64 20 66 72 |ocess is| read fr|
|000051f0| 6f 6d 20 74 68 65 0d 0a | 61 63 74 69 76 65 20 6c |om the..|active l|
|00005200| 6f 63 6b 2e 20 54 68 65 | 6e 20 74 68 65 20 73 69 |ock. The|n the si|
|00005210| 67 6e 61 6c 73 20 7b 5c | 74 74 20 43 4f 4e 54 7d |gnals {\|tt CONT}|
|00005220| 2c 20 7b 5c 74 74 20 49 | 4e 54 7d 2c 20 7b 5c 74 |, {\tt I|NT}, {\t|
|00005230| 74 20 54 45 52 4d 7d 20 | 61 6e 64 0d 0a 7b 5c 74 |t TERM} |and..{\t|
|00005240| 74 20 4b 49 4c 4c 7d 20 | 61 72 65 20 73 65 6e 74 |t KILL} |are sent|
|00005250| 20 69 6e 20 74 68 61 74 | 20 6f 72 64 65 72 2e 20 | in that| order. |
|00005260| 20 4f 6e 20 73 6f 6d 65 | 20 73 79 73 74 65 6d 73 | On some| systems|
|00005270| 2c 20 7b 5c 74 74 20 49 | 4e 54 7d 20 69 73 20 74 |, {\tt I|NT} is t|
|00005280| 68 65 0d 0a 6f 6e 6c 79 | 20 73 69 67 6e 61 6c 20 |he..only| signal |
|00005290| 74 68 61 74 20 77 69 6c | 6c 20 6e 6f 74 20 68 61 |that wil|l not ha|
|000052a0| 6e 67 20 74 68 65 20 70 | 72 6f 63 65 73 73 20 70 |ng the p|rocess p|
|000052b0| 65 72 6d 61 6e 65 6e 74 | 6c 79 20 69 6e 20 63 61 |ermanent|ly in ca|
|000052c0| 73 65 20 6f 66 20 61 0d | 0a 64 69 73 6b 2d 77 61 |se of a.|.disk-wa|
|000052d0| 69 74 20 73 69 74 75 61 | 74 69 6f 6e 2c 20 74 68 |it situa|tion, th|
|000052e0| 75 73 20 7b 5c 74 74 20 | 49 4e 54 7d 20 69 73 20 |us {\tt |INT} is |
|000052f0| 73 65 6e 74 20 66 69 72 | 73 74 2e 20 20 54 68 65 |sent fir|st. The|
|00005300| 6e 20 74 68 65 20 64 65 | 66 61 75 6c 74 0d 0a 74 |n the de|fault..t|
|00005310| 65 72 6d 69 6e 61 74 65 | 20 73 69 67 6e 61 6c 20 |erminate| signal |
|00005320| 7b 5c 74 74 20 54 45 52 | 4d 7d 20 69 73 20 73 65 |{\tt TER|M} is se|
|00005330| 6e 74 2c 20 61 6e 64 20 | 66 69 6e 61 6c 6c 79 20 |nt, and |finally |
|00005340| 74 68 65 20 6e 6f 6e 2d | 69 67 6e 6f 72 61 62 6c |the non-|ignorabl|
|00005350| 65 0d 0a 73 69 67 6e 61 | 6c 20 7b 5c 74 74 20 4b |e..signa|l {\tt K|
|00005360| 49 4c 4c 7d 20 69 73 20 | 73 65 6e 74 2e 20 53 6c |ILL} is |sent. Sl|
|00005370| 65 65 70 20 70 65 72 69 | 6f 64 73 20 6f 66 20 73 |eep peri|ods of s|
|00005380| 65 76 65 72 61 6c 20 73 | 65 63 6f 6e 64 73 20 73 |everal s|econds s|
|00005390| 65 70 61 72 61 74 65 0d | 0a 74 68 65 73 65 20 63 |eparate.|.these c|
|000053a0| 61 6c 6c 73 20 74 6f 20 | 67 69 76 65 20 74 68 65 |alls to |give the|
|000053b0| 20 6b 65 72 6e 65 6c 20 | 61 6e 64 20 70 72 6f 67 | kernel |and prog|
|000053c0| 72 61 6d 20 74 69 6d 65 | 20 74 6f 20 72 65 73 70 |ram time| to resp|
|000053d0| 6f 6e 64 20 74 6f 20 74 | 68 65 0d 0a 73 69 67 6e |ond to t|he..sign|
|000053e0| 61 6c 73 2e 20 20 54 68 | 65 20 7b 5c 74 74 20 43 |als. Th|e {\tt C|
|000053f0| 4f 4e 54 7d 20 73 69 67 | 6e 61 6c 20 69 73 20 70 |ONT} sig|nal is p|
|00005400| 6c 61 63 65 64 20 66 69 | 72 73 74 20 69 6e 20 63 |laced fi|rst in c|
|00005410| 61 73 65 20 74 68 65 20 | 70 72 6f 63 65 73 73 0d |ase the |process.|
|00005420| 0a 68 61 73 20 62 65 65 | 6e 20 73 75 73 70 65 6e |.has bee|n suspen|
|00005430| 64 65 64 20 61 6e 64 20 | 77 61 6e 74 73 20 74 6f |ded and |wants to|
|00005440| 20 65 78 69 74 20 73 74 | 72 61 69 67 68 74 20 61 | exit st|raight a|
|00005450| 77 61 79 2e 20 20 54 68 | 69 73 20 73 68 6f 75 6c |way. Th|is shoul|
|00005460| 64 20 62 65 0d 0a 68 61 | 72 6d 6c 65 73 73 20 74 |d be..ha|rmless t|
|00005470| 6f 20 6e 6f 6e 2d 73 75 | 73 70 65 6e 64 65 64 20 |o non-su|spended |
|00005480| 70 72 6f 63 65 73 73 65 | 73 2e 0d 0a 0d 0a 5c 73 |processe|s.....\s|
|00005490| 65 63 74 69 6f 6e 7b 41 | 64 61 70 74 69 76 65 20 |ection{A|daptive |
|000054a0| 6c 6f 63 6b 73 20 69 6e | 20 63 66 65 6e 67 69 6e |locks in| cfengin|
|000054b0| 65 7d 0d 0a 0d 0a 4f 75 | 72 20 6c 6f 63 6b 69 6e |e}....Ou|r lockin|
|000054c0| 67 20 6d 65 63 68 61 6e | 69 73 6d 20 77 61 73 20 |g mechan|ism was |
|000054d0| 64 65 73 69 67 6e 65 64 | 20 61 6e 64 20 69 6d 70 |designed| and imp|
|000054e0| 6c 65 6d 65 6e 74 65 64 | 20 77 69 74 68 20 63 66 |lemented| with cf|
|000054f0| 65 6e 67 69 6e 65 0d 0a | 76 65 72 73 69 6f 6e 20 |engine..|version |
|00005500| 31 2e 34 2e 24 78 24 20 | 69 6e 20 6d 69 6e 64 2e |1.4.$x$ |in mind.|
|00005510| 20 20 43 66 65 6e 67 69 | 6e 65 20 69 73 20 61 20 | Cfengi|ne is a |
|00005520| 64 65 73 63 72 69 70 74 | 69 76 65 20 6c 61 6e 67 |descript|ive lang|
|00005530| 75 61 67 65 20 61 6e 64 | 20 61 0d 0a 63 6f 6e 66 |uage and| a..conf|
|00005540| 69 67 75 72 61 74 69 6f | 6e 20 72 6f 62 6f 74 20 |iguratio|n robot |
|00005550| 77 68 69 63 68 20 63 61 | 6e 20 70 65 72 66 6f 72 |which ca|n perfor|
|00005560| 6d 20 64 69 73 74 72 69 | 62 75 74 65 64 20 73 79 |m distri|buted sy|
|00005570| 73 74 65 6d 0d 0a 61 64 | 6d 69 6e 69 73 74 72 61 |stem..ad|ministra|
|00005580| 74 69 6f 6e 20 6f 6e 20 | 6c 61 72 67 65 20 6e 65 |tion on |large ne|
|00005590| 74 77 6f 72 6b 73 5c 63 | 69 74 65 7b 63 66 31 2c |tworks\c|ite{cf1,|
|000055a0| 63 66 32 2c 63 66 33 2c | 63 66 34 7d 2e 20 20 41 |cf2,cf3,|cf4}. A|
|000055b0| 20 63 66 65 6e 67 69 6e | 65 0d 0a 70 72 6f 67 72 | cfengin|e..progr|
|000055c0| 61 6d 20 69 73 20 67 65 | 6e 65 72 61 6c 6c 79 20 |am is ge|nerally |
|000055d0| 73 63 68 65 64 75 6c 65 | 64 20 61 73 20 61 20 63 |schedule|d as a c|
|000055e0| 72 6f 6e 20 6a 6f 62 2c | 20 62 75 74 20 63 61 6e |ron job,| but can|
|000055f0| 20 61 6c 73 6f 20 62 65 | 0d 0a 69 6e 69 74 69 61 | also be|..initia|
|00005600| 74 65 64 20 69 6e 74 65 | 72 61 63 74 69 76 65 6c |ted inte|ractivel|
|00005610| 79 20 6f 72 20 62 79 20 | 72 65 6d 6f 74 65 20 6e |y or by |remote n|
|00005620| 65 74 77 6f 72 6b 20 63 | 6f 6e 6e 65 63 74 69 6f |etwork c|onnectio|
|00005630| 6e 2e 20 43 66 65 6e 67 | 69 6e 65 20 63 61 6e 0d |n. Cfeng|ine can.|
|00005640| 0a 65 78 61 6d 69 6e 65 | 20 6d 61 6e 79 20 68 75 |.examine| many hu|
|00005650| 6e 64 72 65 64 73 20 6f | 66 20 66 69 6c 65 73 2c |ndreds o|f files,|
|00005660| 20 73 79 73 74 65 6d 20 | 70 72 6f 63 65 73 73 65 | system |processe|
|00005670| 73 20 61 6e 64 20 6c 61 | 75 6e 63 68 20 64 6f 7a |s and la|unch doz|
|00005680| 65 6e 73 20 6f 66 0d 0a | 75 73 65 72 20 73 63 72 |ens of..|user scr|
|00005690| 69 70 74 73 20 64 65 70 | 65 6e 64 69 6e 67 20 6f |ipts dep|ending o|
|000056a0| 6e 20 74 68 65 20 74 69 | 6d 65 20 6f 66 20 64 61 |n the ti|me of da|
|000056b0| 79 20 61 6e 64 20 74 68 | 65 20 68 6f 73 74 20 63 |y and th|e host c|
|000056c0| 6f 6e 63 65 72 6e 65 64 | 2e 0d 0a 43 66 65 6e 67 |oncerned|...Cfeng|
|000056d0| 69 6e 65 27 73 20 6a 6f | 62 20 69 73 20 74 6f 20 |ine's jo|b is to |
|000056e0| 63 6f 6f 72 64 69 6e 61 | 74 65 20 74 68 65 73 65 |coordina|te these|
|000056f0| 20 61 63 74 69 76 69 74 | 69 65 73 20 62 61 73 65 | activit|ies base|
|00005700| 64 20 74 68 65 20 7b 5c | 65 6d 20 73 74 61 74 65 |d the {\|em state|
|00005710| 7d 0d 0a 6f 66 20 74 68 | 65 20 73 79 73 74 65 6d |}..of th|e system|
|00005720| 2e 20 54 68 65 20 73 74 | 61 74 65 20 63 6f 6d 70 |. The st|ate comp|
|00005730| 72 69 73 65 73 20 6d 61 | 6e 79 20 76 61 72 69 61 |rises ma|ny varia|
|00005740| 62 6c 65 73 20 62 61 73 | 65 64 20 6f 6e 20 68 6f |bles bas|ed on ho|
|00005750| 73 74 20 74 79 70 65 2c | 0d 0a 64 61 74 65 2c 20 |st type,|..date, |
|00005760| 74 69 6d 65 2c 20 61 6e | 64 20 74 68 65 20 70 72 |time, an|d the pr|
|00005770| 65 73 65 6e 74 20 63 6f | 6e 64 69 74 69 6f 6e 20 |esent co|ndition |
|00005780| 6f 66 20 74 68 65 20 68 | 6f 73 74 20 61 73 20 63 |of the h|ost as c|
|00005790| 6f 6d 70 61 72 65 64 20 | 74 6f 20 61 0d 0a 72 65 |ompared |to a..re|
|000057a0| 66 65 72 65 6e 63 65 20 | 6d 6f 64 65 6c 2e 20 20 |ference |model. |
|000057b0| 49 74 73 20 74 6f 74 61 | 6c 20 72 75 6e 20 74 69 |Its tota|l run ti|
|000057c0| 6d 65 20 69 6e 76 6f 6c | 76 65 73 20 74 6f 6f 20 |me invol|ves too |
|000057d0| 6d 61 6e 79 20 76 61 72 | 69 61 62 6c 65 73 20 74 |many var|iables t|
|000057e0| 6f 20 62 65 0d 0a 70 72 | 61 63 74 69 63 61 6c 6c |o be..pr|acticall|
|000057f0| 79 20 70 72 65 64 69 63 | 74 61 62 6c 65 2e 0d 0a |y predic|table...|
|00005800| 0d 0a 4f 70 65 6e 69 6e | 67 20 63 66 65 6e 67 69 |..Openin|g cfengi|
|00005810| 6e 65 20 74 6f 20 74 68 | 65 20 6e 65 74 77 6f 72 |ne to th|e networ|
|00005820| 6b 20 70 6c 61 63 65 73 | 20 61 6e 20 65 78 74 72 |k places| an extr|
|00005830| 61 20 6f 6e 75 73 20 6f | 6e 20 69 74 73 20 62 65 |a onus o|n its be|
|00005840| 68 61 76 69 6f 75 72 0d | 0a 77 69 74 68 20 72 65 |haviour.|.with re|
|00005850| 73 70 65 63 74 20 74 6f | 20 73 63 68 65 64 75 6c |spect to| schedul|
|00005860| 69 6e 67 2e 20 41 6c 74 | 68 6f 75 67 68 20 64 65 |ing. Alt|hough de|
|00005870| 73 69 67 6e 65 64 20 69 | 6e 20 73 75 63 68 20 61 |signed i|n such a|
|00005880| 73 20 77 61 79 20 74 68 | 61 74 20 69 74 0d 0a 64 |s way th|at it..d|
|00005890| 6f 65 73 20 6e 6f 74 20 | 67 69 76 65 20 61 77 61 |oes not |give awa|
|000058a0| 79 20 61 6e 79 20 72 69 | 67 68 74 73 20 74 6f 20 |y any ri|ghts to |
|000058b0| 6f 75 74 73 69 64 65 20 | 75 73 65 72 73 2c 20 63 |outside |users, c|
|000058c0| 66 65 6e 67 69 6e 65 20 | 69 73 0d 0a 69 6e 74 65 |fengine |is..inte|
|000058d0| 6e 74 69 6f 6e 61 6c 6c | 79 20 63 6f 6e 73 74 72 |ntionall|y constr|
|000058e0| 75 63 74 65 64 20 73 6f | 20 74 68 61 74 20 67 65 |ucted so| that ge|
|000058f0| 6e 65 72 61 6c 20 75 73 | 65 72 73 20 28 6e 6f 74 |neral us|ers (not|
|00005900| 20 6a 75 73 74 20 7b 5c | 74 74 20 72 6f 6f 74 7d | just {\|tt root}|
|00005910| 29 0d 0a 63 61 6e 20 62 | 65 20 61 6c 6c 6f 77 65 |)..can b|e allowe|
|00005920| 64 20 74 6f 20 65 78 65 | 63 75 74 65 20 74 68 65 |d to exe|cute the|
|00005930| 20 73 74 61 6e 64 61 72 | 64 20 63 6f 6e 66 69 67 | standar|d config|
|00005940| 75 72 61 74 69 6f 6e 20 | 69 6e 20 6f 72 64 65 72 |uration |in order|
|00005950| 20 74 6f 0d 0a 75 70 64 | 61 74 65 20 6f 72 20 64 | to..upd|ate or d|
|00005960| 69 61 67 6e 6f 73 65 20 | 74 68 65 20 73 79 73 74 |iagnose |the syst|
|00005970| 65 6d 2c 20 65 76 65 6e | 20 77 68 65 6e 20 68 75 |em, even| when hu|
|00005980| 6d 61 6e 20 61 64 6d 69 | 6e 69 73 74 72 61 74 6f |man admi|nistrato|
|00005990| 72 73 20 61 72 65 20 6e | 6f 74 0d 0a 61 76 61 69 |rs are n|ot..avai|
|000059a0| 6c 61 62 6c 65 2e 20 54 | 68 65 20 6d 65 72 65 20 |lable. T|he mere |
|000059b0| 74 68 6f 75 67 68 74 20 | 6f 66 20 74 68 69 73 20 |thought |of this |
|000059c0| 69 73 20 65 6e 6f 75 67 | 68 20 74 6f 20 73 65 6e |is enoug|h to sen|
|000059d0| 64 20 63 6f 6e 76 75 6c | 73 69 6f 6e 73 20 64 6f |d convul|sions do|
|000059e0| 77 6e 0d 0a 74 68 65 20 | 73 70 69 6e 65 73 20 6f |wn..the |spines o|
|000059f0| 66 20 6d 61 6e 79 20 73 | 79 73 74 65 6d 20 66 6f |f many s|ystem fo|
|00005a00| 6c 6b 73 2c 20 61 6e 64 | 20 69 74 20 77 6f 75 6c |lks, and| it woul|
|00005a10| 64 20 69 6e 64 65 65 64 | 20 62 65 20 61 20 63 61 |d indeed| be a ca|
|00005a20| 75 73 65 20 66 6f 72 0d | 0a 63 6f 6e 63 65 72 6e |use for.|.concern|
|00005a30| 20 75 6e 6c 65 73 73 20 | 6d 65 61 73 75 72 65 73 | unless |measures|
|00005a40| 20 77 65 72 65 20 69 6e | 63 6f 72 70 6f 72 61 74 | were in|corporat|
|00005a50| 65 64 20 74 6f 20 70 72 | 6f 74 65 63 74 20 73 75 |ed to pr|otect su|
|00005a60| 63 68 20 61 20 70 72 6f | 76 69 73 69 6f 6e 0d 0a |ch a pro|vision..|
|00005a70| 66 72 6f 6d 20 61 62 75 | 73 65 2e 20 41 64 61 70 |from abu|se. Adap|
|00005a80| 74 69 76 65 20 6c 6f 63 | 6b 73 20 77 69 6c 6c 20 |tive loc|ks will |
|00005a90| 74 68 65 72 65 66 6f 72 | 65 20 70 6c 61 79 20 61 |therefor|e play a|
|00005aa0| 20 63 65 6e 74 72 61 6c | 20 72 6f 6c 65 20 69 6e | central| role in|
|00005ab0| 20 61 0d 0a 60 63 6f 6e | 6e 65 63 74 65 64 27 20 | a..`con|nected' |
|00005ac0| 63 66 65 6e 67 69 6e 65 | 20 65 6e 76 69 72 6f 6e |cfengine| environ|
|00005ad0| 6d 65 6e 74 20 69 6e 20 | 74 68 65 20 66 75 74 75 |ment in |the futu|
|00005ae0| 72 65 2e 0d 0a 0d 0a 57 | 65 20 68 61 76 65 20 74 |re.....W|e have t|
|00005af0| 65 73 74 65 64 20 6f 75 | 72 20 61 64 61 70 74 69 |ested ou|r adapti|
|00005b00| 76 65 20 6c 6f 63 6b 73 | 20 77 69 74 68 20 63 72 |ve locks| with cr|
|00005b10| 6f 6e 20 69 6e 69 74 69 | 61 74 65 64 20 63 66 65 |on initi|ated cfe|
|00005b20| 6e 67 69 6e 65 20 61 73 | 20 77 65 6c 6c 0d 0a 61 |ngine as| well..a|
|00005b30| 73 20 77 69 74 68 20 72 | 65 6d 6f 74 65 20 63 6f |s with r|emote co|
|00005b40| 6e 6e 65 63 74 69 6f 6e | 73 20 77 69 74 68 20 73 |nnection|s with s|
|00005b50| 6f 6d 65 20 73 75 63 63 | 65 73 73 2e 20 54 68 65 |ome succ|ess. The|
|00005b60| 20 6c 6f 63 6b 73 20 64 | 6f 20 69 6e 64 65 65 64 | locks d|o indeed|
|00005b70| 0d 0a 66 75 6c 66 69 6c | 6c 20 74 68 65 69 72 20 |..fulfil|l their |
|00005b80| 72 6f 6c 65 20 69 6e 20 | 70 72 65 76 65 6e 74 69 |role in |preventi|
|00005b90| 6e 67 20 73 65 69 7a 75 | 72 65 73 20 61 6e 64 20 |ng seizu|res and |
|00005ba0| 6f 76 65 72 6c 61 70 73 | 20 77 68 69 63 68 20 63 |overlaps| which c|
|00005bb0| 61 6e 20 6f 63 63 75 72 | 0d 0a 64 75 65 20 74 6f |an occur|..due to|
|00005bc0| 20 75 6e 66 6f 72 65 73 | 65 65 6e 20 64 65 6c 61 | unfores|een dela|
|00005bd0| 79 73 2e 20 54 68 65 20 | 6c 6f 63 6b 69 6e 67 20 |ys. The |locking |
|00005be0| 6f 66 20 69 6e 64 69 76 | 69 64 75 61 6c 20 61 74 |of indiv|idual at|
|00005bf0| 6f 6d 73 20 6d 65 61 6e | 73 20 74 68 61 74 2c 0d |oms mean|s that,.|
|00005c00| 0a 65 76 65 6e 20 74 68 | 6f 75 67 68 20 61 20 70 |.even th|ough a p|
|00005c10| 61 72 74 69 63 75 6c 61 | 72 20 73 63 72 69 70 74 |articula|r script|
|00005c20| 20 6d 69 67 68 74 20 72 | 75 6e 20 6f 76 65 72 20 | might r|un over |
|00005c30| 69 74 73 20 61 6c 6c 6f | 74 74 65 64 20 74 69 6d |its allo|tted tim|
|00005c40| 65 2c 0d 0a 6f 74 68 65 | 72 20 73 63 72 69 70 74 |e,..othe|r script|
|00005c50| 73 20 61 6e 64 20 74 61 | 73 6b 73 20 63 61 6e 20 |s and ta|sks can |
|00005c60| 62 65 20 63 6f 6d 70 6c | 65 74 65 64 20 77 69 74 |be compl|eted wit|
|00005c70| 68 6f 75 74 20 64 65 6c | 61 79 2c 20 63 6f 6d 65 |hout del|ay, come|
|00005c80| 20 74 68 65 20 6e 65 78 | 74 0d 0a 73 63 68 65 64 | the nex|t..sched|
|00005c90| 75 6c 69 6e 67 20 74 69 | 6d 65 2e 20 53 69 6c 6c |uling ti|me. Sill|
|00005ca0| 79 20 6d 69 73 74 61 6b | 65 73 20 63 61 6e 20 61 |y mistak|es can a|
|00005cb0| 6c 73 6f 20 62 65 20 64 | 65 61 6c 74 20 77 69 74 |lso be d|ealt wit|
|00005cc0| 68 0d 0a 75 6e 70 72 6f | 62 6c 65 6d 61 74 69 63 |h..unpro|blematic|
|00005cd0| 61 6c 6c 79 3a 20 61 20 | 63 66 65 6e 67 69 6e 65 |ally: a |cfengine|
|00005ce0| 20 70 72 6f 67 72 61 6d | 20 77 68 69 63 68 20 73 | program| which s|
|00005cf0| 74 61 72 74 73 20 69 74 | 73 65 6c 66 20 69 73 0d |tarts it|self is.|
|00005d00| 0a 69 6d 70 65 72 76 69 | 6f 75 73 20 74 6f 20 74 |.impervi|ous to t|
|00005d10| 68 65 20 61 70 70 61 72 | 65 6e 74 20 72 65 63 75 |he appar|ent recu|
|00005d20| 72 73 69 76 65 20 77 65 | 6c 6c 2c 20 70 72 6f 76 |rsive we|ll, prov|
|00005d30| 69 64 65 64 20 74 68 65 | 20 7b 5c 74 74 0d 0a 49 |ided the| {\tt..I|
|00005d40| 66 45 6c 61 70 73 65 64 | 7d 20 70 61 72 61 6d 65 |fElapsed|} parame|
|00005d50| 74 65 72 20 69 73 20 6e | 6f 74 20 73 65 74 20 74 |ter is n|ot set t|
|00005d60| 6f 20 7a 65 72 6f 2e 20 | 54 68 69 73 20 69 73 2c |o zero. |This is,|
|00005d70| 20 61 66 74 65 72 20 61 | 6c 6c 2c 20 73 69 6d 70 | after a|ll, simp|
|00005d80| 6c 79 20 61 6e 0d 0a 65 | 78 61 6d 70 6c 65 20 6f |ly an..e|xample o|
|00005d90| 66 20 73 70 61 6d 6d 69 | 6e 67 20 28 73 65 65 20 |f spammi|ng (see |
|00005da0| 62 65 6c 6f 77 29 2e 0d | 0a 0d 0a 41 64 61 70 74 |below)..|...Adapt|
|00005db0| 69 76 65 20 6c 6f 63 6b | 73 20 61 72 65 20 76 65 |ive lock|s are ve|
|00005dc0| 72 79 20 69 6d 70 6f 72 | 74 61 6e 74 20 66 6f 72 |ry impor|tant for|
|00005dd0| 20 63 66 65 6e 67 69 6e | 65 3a 20 63 66 65 6e 67 | cfengin|e: cfeng|
|00005de0| 69 6e 65 20 69 73 20 61 | 20 74 6f 6f 6c 0d 0a 77 |ine is a| tool..w|
|00005df0| 68 69 63 68 20 69 73 20 | 73 75 70 70 6f 73 65 64 |hich is |supposed|
|00005e00| 20 74 6f 20 61 75 74 6f | 6d 61 74 65 20 62 61 73 | to auto|mate bas|
|00005e10| 69 63 20 73 79 73 74 65 | 6d 20 61 64 6d 69 6e 69 |ic syste|m admini|
|00005e20| 73 74 72 61 74 69 6f 6e | 20 74 61 73 6b 73 20 61 |stration| tasks a|
|00005e30| 6e 64 0d 0a 77 6f 72 6b | 20 61 73 20 61 20 66 72 |nd..work| as a fr|
|00005e40| 6f 6e 74 20 65 6e 64 20 | 66 6f 72 20 75 73 65 72 |ont end |for user|
|00005e50| 2d 73 63 72 69 70 74 73 | 2c 20 61 6c 6c 6f 77 69 |-scripts|, allowi|
|00005e60| 6e 67 20 61 64 6d 69 6e | 69 73 74 72 61 74 6f 72 |ng admin|istrator|
|00005e70| 73 20 74 6f 0d 0a 63 6f | 6c 6c 65 63 74 20 61 6e |s to..co|llect an|
|00005e80| 20 65 6e 74 69 72 65 20 | 6e 65 74 77 6f 72 6b 27 | entire |network'|
|00005e90| 73 20 73 63 72 69 70 74 | 73 20 69 6e 74 6f 20 61 |s script|s into a|
|00005ea0| 20 73 69 6e 67 6c 65 20 | 70 6c 61 63 65 20 61 6e | single |place an|
|00005eb0| 64 20 70 72 6f 76 69 64 | 69 6e 67 0d 0a 61 20 6e |d provid|ing..a n|
|00005ec0| 65 74 2d 77 69 64 65 20 | 66 72 6f 6e 74 2d 65 6e |et-wide |front-en|
|00005ed0| 64 20 66 6f 72 20 63 72 | 6f 6e 2e 20 20 49 6e 20 |d for cr|on. In |
|00005ee0| 6f 72 64 65 72 20 74 6f | 20 62 65 20 65 66 66 65 |order to| be effe|
|00005ef0| 63 74 69 76 65 20 69 6e | 20 74 68 69 73 20 72 6f |ctive in| this ro|
|00005f00| 6c 65 2c 0d 0a 63 66 65 | 6e 67 69 6e 65 20 6d 75 |le,..cfe|ngine mu|
|00005f10| 73 74 20 73 75 70 70 6f | 72 74 20 61 20 68 69 67 |st suppo|rt a hig|
|00005f20| 68 20 64 65 67 72 65 65 | 20 6f 66 20 61 75 74 6f |h degree| of auto|
|00005f30| 6e 6f 6d 79 2e 20 20 43 | 66 65 6e 67 69 6e 65 20 |nomy. C|fengine |
|00005f40| 61 74 6f 6d 69 7a 65 73 | 0d 0a 6f 70 65 72 61 74 |atomizes|..operat|
|00005f50| 69 6f 6e 73 20 69 6e 20 | 64 69 66 66 65 72 65 6e |ions in |differen|
|00005f60| 74 20 77 61 79 73 2e 20 | 53 6f 6d 65 20 6f 70 65 |t ways. |Some ope|
|00005f70| 72 61 74 69 6f 6e 73 2c | 20 73 75 63 68 20 61 73 |rations,| such as|
|00005f80| 20 66 69 6c 65 20 65 64 | 69 74 69 6e 67 0d 0a 61 | file ed|iting..a|
|00005f90| 6e 64 20 73 63 72 69 70 | 74 20 65 78 65 63 75 74 |nd scrip|t execut|
|00005fa0| 69 6f 6e 2c 20 61 72 65 | 20 6c 6f 63 6b 65 64 20 |ion, are| locked |
|00005fb0| 6f 6e 20 61 20 70 65 72 | 2d 66 69 6c 65 20 62 61 |on a per|-file ba|
|00005fc0| 73 69 73 2e 20 4f 74 68 | 65 72 20 6f 70 65 72 61 |sis. Oth|er opera|
|00005fd0| 74 69 6f 6e 73 0d 0a 77 | 68 69 63 68 20 63 6f 75 |tions..w|hich cou|
|00005fe0| 6c 64 20 69 6e 76 6f 6c | 76 65 20 6c 61 72 67 65 |ld invol|ve large|
|00005ff0| 20 73 63 61 6c 65 20 74 | 72 61 76 65 72 73 61 6c | scale t|raversal|
|00006000| 73 20 6f 66 20 74 68 65 | 20 66 69 6c 65 20 73 79 |s of the| file sy|
|00006010| 73 74 65 6d 20 61 72 65 | 0d 0a 6c 6f 63 6b 65 64 |stem are|..locked|
|00006020| 20 70 65 72 20 63 6c 61 | 73 73 20 6f 66 20 6f 70 | per cla|ss of op|
|00006030| 65 72 61 74 69 6f 6e 2e | 20 54 68 65 20 61 69 6d |eration.| The aim|
|00006040| 20 6f 66 20 74 68 65 20 | 6c 6f 63 6b 69 6e 67 20 | of the |locking |
|00006050| 70 6f 6c 69 63 79 20 69 | 73 20 74 6f 0d 0a 6d 61 |policy i|s to..ma|
|00006060| 6b 65 20 74 68 65 20 73 | 79 73 74 65 6d 20 73 61 |ke the s|ystem sa|
|00006070| 66 65 20 61 6e 64 20 65 | 66 66 69 63 69 65 6e 74 |fe and e|fficient|
|00006080| 20 2d 2d 20 69 2e 65 2e | 5c 20 6e 6f 74 20 74 6f | -- i.e.|\ not to|
|00006090| 20 6f 76 65 72 6c 6f 61 | 64 20 74 6f 20 74 68 65 | overloa|d to the|
|000060a0| 0d 0a 73 79 73 74 65 6d | 20 77 69 74 68 20 63 6f |..system| with co|
|000060b0| 6e 74 72 61 72 79 20 74 | 61 73 6b 73 2e 0d 0a 0d |ntrary t|asks....|
|000060c0| 0a 50 72 65 76 69 6f 75 | 73 6c 79 2c 20 63 66 65 |.Previou|sly, cfe|
|000060d0| 6e 67 69 6e 65 20 70 72 | 6f 63 65 73 73 65 73 20 |ngine pr|ocesses |
|000060e0| 77 65 72 65 20 6c 6f 63 | 6b 65 64 20 62 79 20 61 |were loc|ked by a|
|000060f0| 20 73 69 6e 67 6c 65 20 | 67 6c 6f 62 61 6c 20 6c | single |global l|
|00006100| 6f 63 6b 2e 20 49 66 0d | 0a 61 20 70 72 6f 63 65 |ock. If.|.a proce|
|00006110| 73 73 20 77 65 72 65 20 | 69 6e 74 65 72 72 75 70 |ss were |interrup|
|00006120| 74 65 64 20 66 6f 72 20 | 73 6f 6d 65 20 72 65 61 |ted for |some rea|
|00006130| 73 6f 6e 2c 20 61 20 68 | 61 6e 67 69 6e 67 20 6c |son, a h|anging l|
|00006140| 6f 63 6b 20 77 6f 75 6c | 64 0d 0a 72 65 6d 61 69 |ock woul|d..remai|
|00006150| 6e 20 61 6e 64 20 63 61 | 75 73 65 20 77 61 72 6e |n and ca|use warn|
|00006160| 69 6e 67 20 6d 65 73 73 | 61 67 65 73 20 74 6f 20 |ing mess|ages to |
|00006170| 62 65 20 70 72 69 6e 74 | 65 64 20 66 72 6f 6d 20 |be print|ed from |
|00006180| 74 68 65 20 61 66 66 65 | 63 74 65 64 0d 0a 68 6f |the affe|cted..ho|
|00006190| 73 74 73 20 74 68 65 20 | 6e 65 78 74 20 74 69 6d |sts the |next tim|
|000061a0| 65 20 63 66 65 6e 67 69 | 6e 65 20 77 61 73 20 73 |e cfengi|ne was s|
|000061b0| 63 68 65 64 75 6c 65 64 | 2e 20 43 65 72 74 61 69 |cheduled|. Certai|
|000061c0| 6e 20 63 66 65 6e 67 69 | 6e 65 20 70 72 6f 63 65 |n cfengi|ne proce|
|000061d0| 73 73 65 73 0d 0a 77 6f | 75 6c 64 20 6f 76 65 72 |sses..wo|uld over|
|000061e0| 72 75 6e 20 74 68 65 69 | 72 20 61 6c 6c 6f 74 74 |run thei|r allott|
|000061f0| 65 64 20 74 69 6d 65 3a | 20 74 79 70 69 63 61 6c |ed time:| typical|
|00006200| 6c 79 20 74 68 65 20 77 | 65 65 6b 6c 79 20 72 75 |ly the w|eekly ru|
|00006210| 6e 73 20 77 68 69 63 68 | 0d 0a 70 65 72 66 6f 72 |ns which|..perfor|
|00006220| 6d 20 65 78 74 65 6e 73 | 69 76 65 20 73 79 73 74 |m extens|ive syst|
|00006230| 65 6d 20 63 68 65 63 6b | 69 6e 67 20 61 6e 64 20 |em check|ing and |
|00006240| 75 70 64 61 74 65 73 20 | 6f 66 20 73 79 73 74 65 |updates |of syste|
|00006250| 6d 20 64 61 74 61 62 61 | 73 65 73 2e 0d 0a 54 68 |m databa|ses...Th|
|00006260| 69 73 20 77 6f 75 6c 64 | 20 68 61 70 70 65 6e 20 |is would| happen |
|00006270| 6f 6e 63 65 20 61 20 77 | 65 65 6b 2c 20 67 65 6e |once a w|eek, gen|
|00006280| 65 72 61 74 69 6e 67 20 | 75 73 65 6c 65 73 73 20 |erating |useless |
|00006290| 6d 61 69 6c 20 77 68 69 | 63 68 20 65 76 65 72 79 |mail whi|ch every|
|000062a0| 6f 6e 65 0d 0a 77 6f 75 | 6c 64 20 68 61 76 65 20 |one..wou|ld have |
|000062b0| 62 65 65 6e 20 68 61 70 | 70 69 65 72 20 6e 6f 74 |been hap|pier not|
|000062c0| 20 74 6f 20 72 65 63 65 | 69 76 65 2e 20 20 42 61 | to rece|ive. Ba|
|000062d0| 64 20 4e 46 53 20 63 6f | 6e 6e 65 63 74 69 6f 6e |d NFS co|nnection|
|000062e0| 73 20 74 68 72 6f 75 67 | 68 0d 0a 62 75 67 67 79 |s throug|h..buggy|
|000062f0| 20 6b 65 72 6e 65 6c 73 | 20 68 61 76 65 20 62 65 | kernels| have be|
|00006300| 65 6e 20 6b 6e 6f 77 6e | 20 74 6f 20 68 61 6e 67 |en known| to hang|
|00006310| 20 73 63 72 69 70 74 73 | 2e 20 41 6c 73 6f 2c 20 | scripts|. Also, |
|00006320| 62 75 67 73 20 69 6e 20 | 63 66 65 6e 67 69 6e 65 |bugs in |cfengine|
|00006330| 0d 0a 69 74 73 65 6c 66 | 2c 20 77 68 69 63 68 20 |..itself|, which |
|00006340| 6d 61 6e 69 66 65 73 74 | 20 74 68 65 6d 73 65 6c |manifest| themsel|
|00006350| 76 65 73 20 6f 6e 6c 79 | 20 75 6e 64 65 72 20 73 |ves only| under s|
|00006360| 70 65 63 69 61 6c 20 63 | 6f 6e 64 69 74 69 6f 6e |pecial c|ondition|
|00006370| 73 2c 20 63 6f 75 6c 64 | 0d 0a 72 65 73 75 6c 74 |s, could|..result|
|00006380| 20 69 6e 20 61 20 63 6f | 72 65 20 64 75 6d 70 20 | in a co|re dump |
|00006390| 61 6e 64 20 61 20 68 61 | 6e 67 69 6e 67 20 6c 6f |and a ha|nging lo|
|000063a0| 63 6b 2e 20 20 41 6c 74 | 68 6f 75 67 68 20 65 61 |ck. Alt|hough ea|
|000063b0| 63 68 20 69 73 6f 6c 61 | 74 65 64 0d 0a 6f 63 63 |ch isola|ted..occ|
|000063c0| 75 72 72 61 6e 63 65 20 | 6f 66 20 74 68 65 73 65 |urrance |of these|
|000063d0| 20 70 72 6f 62 6c 65 6d | 73 20 77 61 73 20 72 65 | problem|s was re|
|000063e0| 6c 61 74 69 76 65 6c 79 | 20 72 61 72 65 2c 20 74 |latively| rare, t|
|000063f0| 68 65 20 63 75 6d 75 6c | 61 74 69 76 65 0d 0a 65 |he cumul|ative..e|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.